Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to log into a server with a particular account. Let's say I don't know the password for that account. Can I do this using ssh? I am wondering if it is possible to do it in one command, instead of logging in as root and running su.

share|improve this question

migrated from stackoverflow.com Feb 11 '10 at 0:15

This question came from our site for professional and enthusiast programmers.

    
Hmmm... this may be a bad question, but thanks for the answers. –  Elias Zamaria Feb 17 '10 at 18:35
add comment

4 Answers

This doesn't make sense. If you're logged in as root, a plain su doesn't do anything except start a new shell. Maybe you mean su someotheruser?

As far as I know, most Linux installations don't allow root logging in remotely directly. One first has to log in as an ordinary user and su to become root.

share|improve this answer
    
eh, plenty of systems allow root logins –  jdizzle Feb 11 '10 at 0:05
    
He means using su [-] user form of su to become another user. –  Alok Feb 11 '10 at 0:06
add comment

No ...............

share|improve this answer
add comment

You could probably accomplish this if you were willing to write a PAM module which caused entering the root password to make authentication succeed. Not going to be easy, but it would do what you want...

share|improve this answer
add comment

Another approach would be

ssh root@host su - user
share|improve this answer
2  
you'd have to make sure sshd.conf isn't set to squash root logins. You really don't want to do this (unless you're using key based auth, or some physical token, even then it's too risky) –  skarface Feb 11 '10 at 21:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.