Bash alias - Can one use a bunch of words as alias

William Muriithi william.muriithi-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Feb 11 20:22:47 UTC 2014


Afternoon,

I am trying to override sudo default user without it being transparent to
the users. This is to avoid having to get calls as users have already been
used to using sudo without specifying user.

So at the moment, we use something like this:

sudo service jboss stop

This does something like this:

William -> root > jboss

I want to change the runas on sudoer file so that it run as follows:

William -> jboss

However, this only work if I use

sudo -u jboss service jboss stop

So I created an alias and its then I realized alias seem to work with only
one word

[root at qa10-yyz-int william]# cat /etc/profile.d/sudo.sh # Initialization
script for bash and sh

# Dont use root as default when restarting jboss, imageserver and file
server alias 'sudo service jboss stop'='sudo -u jboss service jboss stop'
2>/dev/null

[root at qa10-yyz-int william]# alias alias stop='sudo -u bhamilton service
jboss stop'

Is there a way to overcome this issue?

Thanks in advance.

William
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20140211/3b3b5775/attachment.html>


More information about the Legacy mailing list