LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I setup my system to make a command alias for all users? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-setup-my-system-to-make-a-command-alias-for-all-users-702301/)

duval_jay 02-04-2009 01:21 PM

How can I setup my system to make a command alias for all users?
 
Anyone know how you create a command alias for all users so they can empty a temporary directory.

arizonagroovejet 02-04-2009 01:25 PM

Well 'empty a temporary directory' is a little vague but assuming your users have bash as their shell put an alias in to /etc/bashrc. Though on SuSE systems it's called /etc/bash.bashrc and if you read the comments at the top it tells you not to put your own stuff in that file but to put it in /etc/bash.bashrc.local

If you don't know how to do bash aliases then

Code:

alias foo='some bunch of commands'

sycamorex 02-04-2009 01:56 PM

If you are talking about /tmp directory - that's probably not the best idea as one user will be able to delete some temp files that another user's application is using at that time.

arizonagroovejet 02-04-2009 02:52 PM

Quote:

Originally Posted by sycamorex (Post 3432238)
If you are talking about /tmp directory - that's probably not the best idea as one user will be able to delete some temp files that another user's application is using at that time.

Users can't delete other user's files in /tmp. At least not unless the default permissions and/or ownership of /tmp have been changed which would not be a sensible thing to have done. Default permissions and ownership on /tmp looks like

drwxrwxrwt 14 root root 4096 2009-02-04 20:00 /tmp/

the significant part being that t which represents the sticky bit that allows any user to create a file in /tmp but only to delete files which they own.

sycamorex 02-04-2009 02:57 PM

Quote:

Originally Posted by arizonagroovejet (Post 3432293)
Users can't delete other user's files in /tmp. At least not unless the default permissions and/or ownership of /tmp have been changed which would not be a sensible thing to have done. Default permissions and ownership on /tmp looks like

drwxrwxrwt 14 root root 4096 2009-02-04 20:00 /tmp/

the significant part being that t which represents the sticky bit that allows any user to create a file in /tmp but only to delete files which they own.


I'm aware of all of it. I wanted to discourage the OP from tampering with /tmp (eg. by removing the sticky bit) to enable users to empty it (ie. delete its contents)


All times are GMT -5. The time now is 01:57 PM.