Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use the terminal to login as another user System
This may seem basic and stupid but it sure helped me out... I have too keep several of my X boxes logged in as a normal user because they are public machines. However I found that whenever I needed to do anything that calls for admin access (ie prebinding), I had to log out and log back in, which is not very convinient.

So I tried typing login in a terminal window and it let me login to terminal as an admin so that I could run the prebinding comand. Handy or not it is cool to know!

[Editor's note: Definitely handy if you login as a non-admin user at times, and want quick access to the admin account!]
  • Currently 2.57 / 5
  You rated: 1 / 5 (7 votes cast)

Use the terminal to login as another user | 6 comments | Create New Account
Click here to return to the 'Use the terminal to login as another user' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Try su
Authored by: Chas on May 06, '01 01:24:35AM

the command "su" is more flexible. You can't login as root, but you can su to root. And when you exit a session after that you initiated with login, your terminal window is dead. When you exit after su, you are returned to your normal shell user account.
Forget login, stick with su.

[ Reply to This | # ]
Can't Try su
Authored by: macavenger on May 06, '01 12:49:06PM

Correct me if I am wrong, but if you are logged in as a non-admin user, you are not allowed to SU. You can still use the sudo command (I think) but of course then you have to type sudo before every command.

[ Reply to This | # ]
Can't Try su
Authored by: itomato on May 06, '01 02:21:39PM

Yes, you sure can su as a normal user. That's who it's for. As root, you can su to _any_ user. So, you can su root, then - as 'Doug' su'd to root, you can su to 'Kathy', too. You can be anybody.

[ Reply to This | # ]
Can't Try su
Authored by: itomato on May 06, '01 02:25:17PM

Forgot about this:
Also, you can tell your shell to be a login shell. When you start Terminal, you get a login: prompt. I'm away from my X box right now, but if you poke around in your .profile or .bashrc or tsch config file, the option should be there. If not, a quick check on Google is sure to turn up the answer.

[ Reply to This | # ]
Note of Caution
Authored by: Anonymous on May 06, '01 06:34:16PM
This is indeed a handy bit of knowledge, but there are a few points that we all need to start taking into consideration, most importantly: security.

I have three machines in my office, two more or less public machines as mentioned in the original post. Even though they are just a couple of feet apart, I will do the same as my students are often sitting at these machines. I can't kick them off just to do something, so I'll connect remotely and then use sudo. As of 10.0.2, ssh is now standard, so it's easy (and secure) to ssh other.machine from my desk, sudo mail, for example, and then log out. The students never know the machine is dually being used, and, more importantly, they have no way of gaining information about root!

Logging into root, though handy, is considered insecure as others could gain knowledge of the login information. Telnet and rlogin (both very, very handily used in the past) are also suspect these days in relation to security. Use ssh and sudo (or, if you are doing several things, su), and keep your machines secure.

Just a note of caution.


[ Reply to This | # ]
twist on this ...
Authored by: moyashi on Jun 09, '01 02:26:46AM

I'm using my box as a home system and as a webpage development system.

Therefore I have 2-3 users on my system each setup with their own preferences. different docks, different startup items, etc...

This is very useful since I always know what I'm working on and protects myself from doing something stupid ... sometimes ;-)

Now, the only pain is that I also have my email addresses setup that way too. Obviously, I could have everything pointing to me (the main user) but ,my main mail box is already overcrowded. I like how I just see mail from my friend's site that I'm working on.

Is there anyway to access my mail to my other users without loggin out and loggin back in as a different user?

[ Reply to This | # ]