March 25th, 2011, 07:17 AM
TTY, access rights, impact
I've got the situation in which some command should open the TTY for writing. It's called with permissions that do not allow writing to this TTY.
I modify bash script and I have 3 solutions to avoid this issue, here they are:
1) to add write permissions for `other` (chmod o+w My_tty)
2) to change group-owner (chgrp applicable_group My_tty)
3) to change user-owner (# chown applicable_user My_tty)
The above actions are to be placed by me right before calling of my command.
My question is: what is the best? For the last solution I need to perform this action under root - it's not convenient and requires additional manipulations. As for the second solution - I think that it's better that all TTYs belong to tty group. And the first solution looks nice for me - simple and provides what I need. But in this case it seems like everyone will be able to write to this TTY (although it is unlikely will be used by my target users).
So, what do you think of it? Can you guess any unexpected impact for each solution? Maybe there's a better solution. Any offers and comments are welcome.
Thanks in advance,