Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

At work, I have a few legacy servers that I log into as root, and then su down to a user. I continue to run into an issue where after doing so, I am unable to run screen as this user.

I don't want to open screen as root, because then I have to consciously su down the user every new shell, and I often forget.

The question is, is there an easier resolution to this than I'm currently aware of? My current solution is to find my terminal pts number, then set it chmod 666.

I'm looking for something akin to X11's xhost ACL management, if such a thing exists for this situation.

share|improve this question
    
See serverfault.com/questions/116775/… for a solution which doesn't involve chown'ing terminal devices manually (yuck!). –  voretaq7 Mar 29 '10 at 21:54
add comment

1 Answer

up vote 1 down vote accepted

It's a bad idea to chmod root's TTY to 666 for reasons that are hopefully obvious. Instead, transfer ownership to the target user, and change it back later.

A bash function to make this all simpler is:

screenas() { chown $* ``tty`` && su - $* -c screen && chown root `tty` }

Paste that into your .bashrc file, and, to run screen as a user, screenas username.

share|improve this answer
    
I was figuring a chown would be the best way (perhaps, "The Right Way"?) to go about it, and I could drop that function in, and alias screen to call it, then run screen with the original parameters given. –  VxJasonxV Mar 29 '10 at 20:31
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.