LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to change a user's Home directory (https://www.linuxquestions.org/questions/linux-general-1/how-to-change-a-users-home-directory-28670/)

n1wil 08-24-2002 02:40 AM

how to change a user's Home directory
 
Hi here is what I need to do:

I need to change the HOME directory for a user. Here is the env info:

[netwiz@linux netwiz]$ env
PWD=/home/netwiz
HOSTNAME=linux.wizworks.net
QTDIR=/usr/lib/qt3-gcc2.96
LESSOPEN=|/usr/bin/lesspipe.sh %s
USER=netwiz
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi= 01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01 ;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz =01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3 5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
MAIL=/var/spool/mail/netwiz
INPUTRC=/etc/inputrc
LANG=en_US.iso885915
SSH_CLIENT=192.168.80.106 32861 22
DISPLAY=localhost:10.0
LOGNAME=netwiz
SHLVL=1
SHELL=/bin/bash
HISTSIZE=1000

HOME=/home/netwiz <------ I want to change this to "/home"

TERM=xterm
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/netwiz/bin
SSH_TTY=/dev/pts/0
_=/usr/bin/env


Any help would be GREATLY appreciated!

~ John

MartBrooks 08-24-2002 02:58 AM

Edit /etc/passwd, change the home dirdctory to whatever it is you want.

Make sure the new home directory is owned by the user.

Regards

n1wil 08-24-2002 12:08 PM

Bas Prompt
 
Ok thanks for replying, but now there's something different. My Bash Prompt has changed. How do I make it say:

netwiz@linux home$ ?

this is what is looks like now, I'll also post the env data:

bash-2.05a$ env
PWD=/home
HOSTNAME=linux.wizworks.net
QTDIR=/usr/lib/qt3-gcc2.96
LESSOPEN=|/usr/bin/lesspipe.sh %s
USER=netwiz
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi= 01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01 ;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz =01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3 5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
MAIL=/var/spool/mail/netwiz
INPUTRC=/etc/inputrc
LANG=en_US.iso885915
SSH_CLIENT=192.168.80.106 32780 22
DISPLAY=localhost:10.0
LOGNAME=netwiz
SHLVL=1
SHELL=/bin/bash
HISTSIZE=1000
HOME=/home
TERM=xterm
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
SSH_TTY=/dev/pts/0
_=/usr/bin/env
bash-2.05a$ <--- this is what it changed to, which doesn't show the current dir.

MartBrooks 08-24-2002 12:23 PM

man bash

and take a look at the PS1 and PS2 variables.

Regards

n1wil 08-24-2002 01:12 PM

Ok I looked inthe man page, but it is not clear how to make use of the PS1 or PS2 variables. Where are they set? How do you set them, do you have to be logged in as the current user or as root?

Thanks for the speedy replies.

~ John

acid_kewpie 08-24-2002 01:24 PM

can i just suggest that you DON'T change it.. it's very very poor practise to deliberatly break conventions. i can guess that it's becuase you only have one user etc... but you really shouldn't

typically though PS1 would be set in somewhere like /etc/bashrc can't guess why it's changed for you though... maybe you've not copied your .bashrc file from your original home directory? that's the file that will call the global bashrc

n1wil 08-24-2002 01:44 PM

Chris,

I tried copying the .bashrc file to the new home directory, no effect. I have multiple users on the system. I only want to change the prompt for one user.

I checked the .bashrc file against the file of another user and they are identical.

This system is a RED HAT 7.3 set up as a server.

acid_kewpie 08-24-2002 03:01 PM

well stricly speaking you should have an /etc/skel directory, the contents of which should comprise the essesntial files for a user directory. still a very very bad thing to do though

n1wil 08-24-2002 03:22 PM

ok then. I'll leave well enough alone. But thanks for your help and willingness to respond.

~ John


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