How to change Home Directory (/home to /other)?

17 posts / 0 new
Last post
#1 Tue, 11/18/2008 - 20:48
Guru

How to change Home Directory (/home to /other)?

I need to change user's default Home directory from /home/user to /other/user.

Within my Ubuntu machine, I have updated /etc/defaults/useradd to point to that other directory, but Virtualmin still creates user's home directory in /home.

I have also tried to manually insert /other into the Server Template, but still no use.

Please help. Thank you.

[Virtualmin 3.63.gpl on Ubuntu Linux 8.04.1]

Wed, 11/19/2008 - 04:17
andreychek

Howdy,

You can do it -- just remember that suexec is compiled with support to work under /home. If you wish to use a directory outside of /home for your homedirs, that's fine, but it means that you either need to recompile suexec, or disable it.

To change the homedir, look in System Settings -> Module Config -> Defaults for new domain.
-Eric

Thu, 11/20/2008 - 00:42 (Reply to #2)
sgrayban

Your gonna break apache !!! Take heed to what andreychek wrote.

Wed, 04/08/2009 - 06:20 (Reply to #3)
colech

<b>andreychek wrote:</b>
<div class='quote'>Howdy,

You can do it -- just remember that suexec is compiled with support to work under /home. If you wish to use a directory outside of /home for your homedirs, that's fine, but it means that you either need to recompile suexec, or disable it.

To change the homedir, look in System Settings -&gt; Module Config -&gt; Defaults for new domain.
-Eric</div>

I am not a native to Linux although I do use it. Can you please explain in painful detail what suexec really does for me? Here is my situation:

I am running a dedicated RHEL server at Rackspace. As you probably already know, the default directory for the web server is /var/www/html. I do not want to change all of this to just accomodate Virtualmin's default directory and I want to keep the default compile of Apache since I would loose the automatic update ability that I get with RHEL and Rackspace when I have not strayed from the default install too far. What kind of security do I loose? Is it just security of Webmin/Virtualmin users or is it a much larger security hole? Please help me understand.

Wed, 04/08/2009 - 09:34 (Reply to #4)
andreychek

Well, remember that if you go with the &quot;Virtualmin stack&quot;, that includes the Virtualmin RPM repository -- which includes an up to date version of Apache. If security issues come up, the version of Apache in the Virtualmin repository is updated, just like in RHEL. In fact, I think RHEL's version of Apache is what's used for all that... just with the modified version of suexec.

Virtualmin's directory is changed from the RHEL/CentOS default, as the goals are different. Virtualmin is designed to help lots of users be able to run websites and emails on the system. Having their websites run out of /home makes more sense than using the system directory of /var/www.

The usage of suexec here is similar -- it provides security when multiple &quot;untrusted&quot; users and scripts are involved. Suexec makes it so that scripts in a users directory run as the user who owns it, rather than as the central &quot;apache&quot; user.

If in general, you trust the users on your system, then suexec may not be necessary, and you can certainly disable it.
-Eric

Sat, 11/22/2008 - 04:03
Maurizio1230

Is it possible to make double home directory.
For example one in /home and another one in /home2 (another monted hard disk)?

Thanks

Mon, 11/24/2008 - 21:46
Guru

Well that's bad in case of Amazon's EC2+EBS platform!

I was trying to setup Virtualmin on Amazon's EC2 platform + EBS storage ... and I thought it was ME who was doing something wrong, as I am a relative newbie when it comes to setting up a linux machine, and so I tried so hard to make it work ... customized the server templates etc!

This is what happens with EBS: To hook persistent storage from EBS on one's Linux virtual machine on Amazon, one has to mount the EBS volume on the EC2 machine (say /ebs). So, to create a virtual host .. it has to end up in /ebs/domain/........

Anyway, I hope there's a way to make Vitualmin work on EC2+EBS!

Mon, 11/24/2008 - 23:28 (Reply to #7)
Joe
Joe's picture

You can mount EBS anywhere you want, can't you? Why not mount it on /home? (It doesn't matter that a /home directory already happens to exist...Linux allows things to be mounted over existed directories, even if they are non-empty.)

--

Check out the forum guidelines!

Tue, 11/25/2008 - 03:00
Guru

^ Hmm that's not a bad idea. So in essence, I could move in all data directories, which I want to keep persistent between machine/instance terminations, inside a /home directory (/home/ebs)? Including data directories of apache, mysql, postgresql, subversion, etc?

Thanks for the tip Joe. I would certainly like to try that out! :)

Tue, 11/25/2008 - 12:28 (Reply to #9)
Joe
Joe's picture

<div class='quote'>inside a /home directory (/home/ebs)?</div>

I meant mount it right on /home. No subdirectory at all. It should work fine. As I mentioned, mounting on top of an existing directory is perfectly sane with Linux.

<div class='quote'>Including data directories of apache, mysql, postgresql, subversion, etc?</div>

Well, with Virtualmin data directories for Apache and Subversion are already in /home. /var has the databases...and that is in the persistent 10GB, by default, on an EC2 instance. So, as long as you're not getting bigger than that, you can probably leave them in place. But, you could also mount an EBS on each of the subdirectories of /var you need.

And, of course, moving them into /home is also an option...but probably not the easiest.

--

Check out the forum guidelines!

Sat, 01/18/2014 - 11:20
thesmahesh

Team,

If i mount my EBS under /home, will the domain/virtual server's files be stored in the /home of the persistent/root device or in my EBS mounted at /home ?

Please clarify.

thanks and regards

Sat, 01/18/2014 - 11:51
Locutus

It will be stored on whatever device is mounted at /home; Virtualmin is certainly not going to bypass filesystem mounts (I wonder if it could do so even if it wanted to ;) ).

E.g., on my Virtualmin systems I usually have a separate HDD partition mounted at /home, no issues at all with that.

Sat, 01/18/2014 - 22:06
thesmahesh

Hello Locutus, thanks for the info. Can u also please help me on how to set to store all my mysql databases in my EBS storage mounted at /home ?

thanks and regards

Sun, 01/19/2014 - 04:13 (Reply to #13)
Locutus

Yeah that's rather easy. I can't look up the precise paths right now, so you might have to do some searching, but you need to roughly do this:

Create a directory like /home/mysql. Stop MySQL, then move the contents of its data directory /var/lib/mysql to the new folder. Go to /etc/mysql/my.conf and find the reference to the old data directory and change it for the new one. Do the same in Webmin's MySQL module configuration where there's also a path reference to the data directory.

If you have some protection software like SELinux or AppArmor installed, you might have to change MySQL's path access rights in those config files too.

Then restart MySQL and you should be set.

Mon, 10/20/2014 - 02:31
alexo

Hello

I just renamed my domain name via this tool

Virtualmin => Server Configuration => Change Domain Name - changed Domain name - Rename Now, (restart htttpd), but if i put domain files in /home/user/public_html (Change home directory - is /home/user ) i got 403 error.

Looks like i did something wrong !!! VPS restart don't fix my problem, may be the best thing will be to edit it manually ?

Any advice will be appreciated !~

Tue, 01/06/2015 - 06:46
gte451f

Warning, this is not recommended.

When I attempted to mount my EBS volume at /home, I locked myself out of the machine due to the SSH key based auth issues.

This is despite the fact that I copied the previous contents of original /home to new EBS /home.

Basically, the keys that allow me access the machine via SSH are not available after I set the new mount point.

Perhaps I did something wrong, but I would advise against attempting to mount an EBS volume at /home w/o first finding a way to make sure all expected keys are in place so you can log back into the machine in the future.

Fri, 01/19/2018 - 14:19
hasse_basse

Right, not reccomended, I just locked myslef out from Webmin, BUT I can connect over Putty so I hope I will have some help to solve this as I use a pro account.

BUT it worked fine for the 2 first domaines but after the 3d I lost connection. The 3d domain has a certificate I use for logging in to Webmin (beside using it for my webshop)

Be careful

Hans

Topic locked