?
Solved

Creating global alias

Posted on 2006-04-06
4
Medium Priority
?
560 Views
Last Modified: 2013-11-17
How do you create permanent aliases for all users in 5.2?

I want these two:

PDC # alias ccllive='cd /...... bla ....../livescripts'
PDC # alias ccltest='cd /...... bla ....../testscripts'

I created the aliases under root, but the users can't run the aliases.
0
Comment
Question by:JohnLucania
4 Comments
 
LVL 14

Assisted Solution

by:sjm_ee
sjm_ee earned 400 total points
ID: 16391987
"alias" is a shell command. If you want a shell command to be excuted by all users when they login, then you can put it in /etc/profile. But settings made by alias are not replicated in child processes. Also, not all users have to use the same shell. So the general answer to your question will be somewhat complicated. You would have to create a .profile for each user which the user cannot change pointing to a similarly protected korn shell profile which sets the aliases. If I have time I will experiment and post back if I find the way.
0
 

Author Comment

by:JohnLucania
ID: 16392764
For each user, do you mean this?

root@prod2:/home/jlucania>
PDC # vi .profile
".profile" 9 lines, 254 characters


PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.

export PATH

if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.
alias ccllive='cd /...bla.../livescripts'
alias ccltest='cd /...bla.../testscripts'

0
 
LVL 8

Assisted Solution

by:arkoak
arkoak earned 400 total points
ID: 16393140
simple
create another *.rc file in the root directory with execute permissions.
now add this file to be executed in all users .profile file

so whatever you will add in this single *.rc file, that will be effective for all users.

0
 
LVL 62

Accepted Solution

by:
gheist earned 1200 total points
ID: 16393632
set aliases in /etc/profile

make sure /etc/profile and ~/.profile are not interactive - cron uses them and will hang on asked input.

Have fun.

for csh (not bask/ksh/sh) you have to include file into users .cshrc file, hope you do not have such users.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question