[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]


    Search the Q&A Archives


...way to su to another user? I keep getting...

<< Back to: Welcome to comp.unix.shell [Frequent posting]

Question by d.martinez
Submitted on 5/14/2004
Related FAQ: Welcome to comp.unix.shell [Frequent posting]
Rating: Not yet rated Rate this question: Vote
is there a way to su to another user? I keep getting prompted for the password and no one i know knows how to get around this, ie i login as me, but need to su to sales:
su sales
pwd:
how can i script this to enter the password?


Answer by Vivek
Submitted on 12/21/2004
Rating: Not yet rated Rate this answer: Vote
The Command su can be used by two categories of users, the Root, that is, su and all other users.

    when su wants to login as root from any other user session, then he/she can do so by giving the su with no option and by supplying the root password. By this way the root can take the form of that user and the privileges will be same as that of that user to which login was made by su.
   Ex:
[training1@linuxcvs training1]$ pwd
/home/training1
[training1@linuxcvs training1]$ su
Password:
[root@linuxcvs training1]# pwd
/home/training1    

   on the other hand, when su is in his/her own id and when su wants to login as some other user while being in super user account then su can do so just by giving the su + account user's name. This situation will not prompt for password.
      Ex:
[root@linuxcvs /root]# pwd
/root
[root@linuxcvs /root]# su training1
[training1@linuxcvs /root]$ pwd
/root  

    But when the other users want to login as su, then there have to give the su + other user account's name to which they want to login and in addition should give the password of that user to which the user wants to login.
Ex:
[training1@linuxcvs training1]$ su training1
Password:
[training1@linuxcvs training1]$

   This cannot be put directly in a script as this gives the error:
standard in must be a tty
   meaning the input can should be supplied from the terminal only.

With Regards,
Vivek

 

Answer by michaeljsamples
Submitted on 6/15/2005
Rating: Not yet rated Rate this answer: Vote
i would like to set up a new account please

 

Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.


Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.

 

FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.

 

<< Back to: Welcome to comp.unix.shell [Frequent posting]


[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.