[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Changing user while being root will leave you to the root homedir.



	Hi.

On Tue, Mar 19, 2019 at 10:57:04AM +0200, aprekates wrote:
> In a new debian 9.8 installation i noticed that:
> 
> root@s165:~# pwd
> /root
> 
> root@s165:~# su chomwitt
> chomwitt@s165:/root$
> 
> ..and from there i cant even execute ls.

It's expected, su(1) says that:

The current environment is passed to the new shell


That includes $PWD, which is current working directory for the shell.
Use "su - chomwitt", it'll work the way you expect it.

Reco


Reply to: