Link to home
Start Free TrialLog in
Avatar of Troder
Troder

asked on

Setting an Alias as root

I wanted to know how to set an alias as root
I can set an alias while logged in as root
alias psm "/usr/ucb/ps auxgw | more"
but this is removed once I log out.
how would I set a permanant alias?

ASKER CERTIFIED SOLUTION
Avatar of PsiCop
PsiCop
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nisus091197
Nisus091197

Hi,

Create a file calle /.profile and put the 'alias ...' line in the file.

When a user logs in his .profile is run.  This can also be used to add directories to the PATH, MANPATH etc.

Hope this helps,

Regards, Nisus
http://www.omnimodo.com
Optimally, you should never log directly in as root. Instead, log in as yourself, and either use sudo to escalate privledge for specific tasks, or use su to gain root privs. Allowing root login from anywhere but the console, especially if you're not using SSH, is a Bad Idea (tm).
PsiCop is perfectly correct.  In fact I would prefer to use ssh rather than telnet.  You can setup trusting so it is a trivial matter to wander around all your servers, and everything is encrypted.

If you did not setup the box, have a look at the /etc/passwd to find out where's the root's
home dir, default is /, but some sys adm (including me) put the root's home dir in a place
other then /. then modify (or create) the .profile file under root's home dir and put your
alias in the file, you can add other ENV settings eg:
PATH,  MANPATH, LD_LIBRARY_PATH .... etc in the same file.

For security reason, turn off telnet and ftp in your system (plain text password), use ssh
instead. at least don't allow root telnet/ftp from outside to the box.