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'm having a communication problem with my IT department, and as a newb with terminal, this is really frustrating because I can't understand why I'm doing the things I'm instructed to do. All they're telling me is that I have to do it.

I have a server that I ssh into as anyone would: ssh myname@thehost and I enter my password.

This is where I get confused: IT told me that now I have to run this command: sudo -iu otherusername.

While I have looked up what those options -iu are (so I know that it's a "simulated initial login" -- whatever that means -- as this otherusername), but I don't actually understand what they mean or why I have to do this. So, my first question is, why do you think I have to do this? Why would one run such a command?

My next question is, how do I upload files to this server given that I have to log in as a different user after the initial login? I haven't tried, but can I simply scp thefile myname@thehost:theDirectory? How do I know which files are shared?

Sorry if these questions are especially newb. Gotta start somewhere, right? ;-)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

sudo -iu <username> logs you in as <username>, without having to know <username>'s password.

You have to be on the sudoers list for this to work, but if your IT department is asking you to do this, you presumably already are.

If you scp files to the server they will end up owned by the initial user, so you may have to move them to the correct location (and perhaps re-chown them) afterwards.

share|improve this answer
    
doesn't the -i implicate the use of the defined login-shell (from /etc/passwd), and thus the execution of specific ressource files such as .profile as well? –  Izzy Jul 20 '12 at 20:27
    
Yes, that's what I was trying to summarise by saying "logs you in". Without -i you don't get a shell and you will need to specify a command for sudo to run. –  David Jul 21 '12 at 23:05
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.