LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Login into a dir diff than home (http://www.linuxquestions.org/questions/linux-newbie-8/login-into-a-dir-diff-than-home-420581/)

scrupul0us 03-01-2006 07:30 AM

Login into a dir diff than home
 
I have just created an account for the webadmin on my box and his home is:

/home/webroot/

however, I would like it that when they login the defulat dir be:

/var/www/htdocs/

obviously i didnt make that the users home else all the settings would be published in the webfolder

is there a way todo this?

~Brian

aminmohan 03-01-2006 07:47 AM

to change the default home dir of the user
use usermod -d /var/www/htdocs webroot

else for the new user use adduser -d <dir_name> <user>

aminmohan 03-01-2006 07:48 AM

to change the default home dir of the user
use usermod -d /var/www/htdocs webroot

else for the new user use adduser -d <dir_name> <user>

scrupul0us 03-01-2006 12:44 PM

nice! thank ya much

mbreith 03-01-2006 12:49 PM

Would doing this make all the config files and default file storage redirect to the /var/www/htdocs/ directory?

would adding a cd /var/www/htdocs/ in one of the user login scripts work better?

scrupul0us 03-01-2006 01:28 PM

i dont think it does (per my question)... it just tells what its default directory is, not its home directory... by default, a users default dir is its home dir

gilead 03-01-2006 02:27 PM

The user's default directory is their home directory. The usermod -d command changes the user's home directory entry in the /etc/passwd file. Doing things in the order that you have (create the user and then change the home directory) should still have the desired effect though, because all of the settings are in their old home directory. Any new config files that get created will be put in the new home directory.

If you do ever want to move the contents of the old home directory use the -m switch to usermod as well as the -d switch.

scrupul0us 07-21-2006 09:10 PM

i just tried the -m switch and got /<folder name> already exists

scrupul0us 07-21-2006 09:11 PM

usermod -d /root -m root
usermod: directory /root exists

i just wanted to move root back to its rightful dir... i had it set to another for the longest time and would like to move it back


All times are GMT -5. The time now is 04:46 AM.