1834082 Members
2289 Online
110063 Solutions
New Discussion

Re: su problems

 
SOLVED
Go to solution
pedliz11
Frequent Advisor

su problems

i have a server that when you login as root if you do a su - (anotherusername) it stills stays as root. Any suggestions?
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: su problems

Hi:

Upon what behavior do you base your conclusion? what does 'id' show?

Regards!

...JRF...
pedliz11
Frequent Advisor

Re: su problems

the # sign designates root if i su to anotheruser name the # remains the same example: su - piuser
comes back with /home/piuser#
Pete Randall
Outstanding Contributor

Re: su problems

That's hardly a guarantee that you are in fact still root.
And what does "id" show?


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: su problems

HI (again):

> the # sign designates root if i su to anotheruser name the # remains the same

If the login profile of the account to which you 'su - ' sets the PS1 prompt to "#" then this is going to look like a 'root' prompt.

What is the PS1 prompt in the target user's '.profile'?

Most importantly, as I first said:

What does 'id' show after the 'su'?

# id
# su - anotherusername
# id

Regards!

...JRF...
pedliz11
Frequent Advisor

Re: su problems

this is the output:
phdb1057/home/root#pwd
/home/root
phdb1057/home/root#whoami
root
phdb1057/home/root#id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
phdb1057/home/root#su - piuser1
(c)Copyright 1983-2003 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993 The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2003 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.


RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the U.S. Government is subject to
restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause in DFARS 252.227-7013.


Hewlett-Packard Company
3000 Hanover Street
Palo Alto, CA 94304 U.S.A.

Rights for non-DOD U.S. Government Departments and Agencies are as set
forth in FAR 52.227-19(c)(1,2).

***************************************************************************
NOTICE TO USERS


This computer system is the private property of Pepsico and It's Authorized Users, whether
individual, corporate or government. It is for authorized use only.
Users (authorized or unauthorized) have no explicit or implicit
expectation of privacy.

Any or all uses of this system and all files on this system may be
intercepted, monitored, recorded, copied, audited, inspected, and
disclosed to your employer, to authorized site, government, and law
enforcement personnel, as well as authorized officials of government
agencies, both domestic and foreign.

By using this system, the user consents to such interception, monitoring,
recording, copying, auditing, inspection, and disclosure at the
discretion of such personnel or officials. Unauthorized or improper use
of this system may result in civil and criminal penalties and
administrative or disciplinary action, as appropriate. By continuing to use
this system you indicate your awareness of and consent to these terms
and conditions of use. LOG OFF IMMEDIATELY if you do not agree to the
conditions stated in this warning.

****************************************************************************

# id
uid=0(root) gid=3(sys)
# pwd
/home/piuser1
#
Dennis Handly
Acclaimed Contributor

Re: su problems

>if do a su - (anotherusername) it stills stays as root. Any suggestions?

You didn't do "anotherusername", you did "an_alias_for_root".

What does the passwd entry for piuser1 show?

(Showing us the whole copyright info wasn't all that useful. We trust you'll copy the important stuff. :-)
It would have been helpful to do just "su piuser1" then do id(1).

># id
>uid=0(root) gid=3(sys)
># pwd
>/home/piuser1

This shows you are root but you have the home directory of piuser1. So piuser1 == root.
Note: If you did just "su" and you started in /home/piuser1, the pwd wouldn't be helpful.
Rasheed Tamton
Honored Contributor

Re: su problems

Check the user id on the /etc/passwd file. If it is saying 0, that means it is same as root.

grep piuser /etc/passwd
grep root /etc/passwd

Otherwise, change to a new user id for the piuser.

Sajjad Sahir
Honored Contributor

Re: su problems

Dear friend
once done su
what is the id displaying this is what we are asking inorder to check id
other wise
what is u /etc/passwd file
id anotherusername /etc/passwd
please send this output