Tuesday, June 22, 2010

su, sudo, and /dev/pts/*

I have a few separate accounts even on my own local machine just to organize things slightly differently for different projects I am working on. Let's call my standard account "s" and one of the other accounts "q". When my machine starts up, I log in as "s", then when I need to work as "q" I use su - q to switch. Seemed like a good idea at the time.

The problem is that /dev/pts/* is owned by "s" since apparently it gets created when "s" first logs in. Now as "q" I can't use things like /dev/stdin or run screen because the permissions on /dev/pts/* are not "permissive" enough. I could probably find a way to open up the permissions, but that doesn't seem quite right. What I really want is to have "q" create it's own /dev/pts/* owned by "q".

For the longest time I couldn't find a way to get this done. Then yesterday it occurred to me to try sudo login instead of su - q and that actually works! You can't do login by itself, it'll complain, but sudo login seems fine. So my problem is apparently fixed, although now I do wonder if there are any security problems with my new approach to switching users. Anyone?

No comments:

Post a Comment