LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   SUing to LFS user doesn't ask for password (https://www.linuxquestions.org/questions/linux-from-scratch-13/suing-to-lfs-user-doesnt-ask-for-password-766070/)

StupidNewbie 11-01-2009 05:07 PM

SUing to LFS user doesn't ask for password
 
Hi all, a few quick questions about this...

I've created the LFS user and can bounce back and forth between lfs and root w/ no problems. Only thing I find strange is that even after I set a password for lfs, it doesn't authenticate when I switch from root. So I can type (as root):

Code:

su - lfs
And it just dumps me right into lfs' home directory. That's fine, but shouldn't it ask for the password I created?

In logging in, I also noticed a couple things. if I am logged in as lfs, and I su root, it will ask me for a password and just dump me to root at /home/lfs. If I su - root it dumps me to root at ~. What's the difference?

Same with the lfs user. If I su - lfs I get the lfs [~]$ prompt. If I simply su lfs with no dash I get the bash 3.2$ prompt. What's the difference there?

Thanks for any advice/insight you can provide. I am still moving forward with this so no rush on answers, just a little curious what this stuff means.

stickman 11-01-2009 05:13 PM

Root doesn't need a password to su. That account is all powerful.

StupidNewbie 11-01-2009 10:43 PM

That's what I figured.

So what's the difference between
Code:

su - [username]
and
Code:

su [username]
? I don't really understand the explanation in the man pages...does it just dictate where you are dumped?

druuna 11-02-2009 04:31 AM

Hi,

In short:

su - -> This will give you a full blown root account. You are placed in root's home directory and all the environment related files are loaded. The - is short for -l/--login, which would give you a so called login shell.

su -> Become root but all other stuff is still the same as the original user. You are still in the dir you issued the command and the environment is still that of the original user.

To see just one of the differences try both and issue a echo $PATH.

Hope this clears things up a bit.

StupidNewbie 11-02-2009 03:29 PM

Good explanation. Thanks!


All times are GMT -5. The time now is 09:17 AM.