Auto transfer all aliases from one profile to another


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Auto transfer all aliases from one profile to another
# 1  
Old 02-29-2016
Hammer & Screwdriver Auto transfer all aliases from one profile to another

Hi,

I login to Linux and Solaris server using my personal user account "ms1104" .

I have several aliases set in my profile.

Later i need to switch to another user account i.e. "wlsuser" and below is the command i use

Code:
sudo -u wlsuser -s -H

i do not have authority to modify the profile for wlsuser account.

I wish to carry all my aliases from "ms1104" to "wlsuser" and all the aliases should work after switching to account "wlsuser"

Last edited by mohtashims; 02-29-2016 at 12:45 PM..
# 2  
Old 02-29-2016
Create a separate file in your (ms1104) home directory that defines all of the aliases you use when you login as ms1104 by moving those alias definitions from your .profile (or whatever startup file your shell uses to define aliases when you login) file and adding a line in your .profile file to source that file. For example if you moved the alias definitions into .ms1104aliases, add the line:
Code:
. .ms1104aliases

to your .profile file.

Then after you sudo to user wisusr, run the command:
Code:
. ~mis1104/.ms1104aliases

before you do anything else.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Whats the profile file that is auto executed when I login

Hi, I dont find any .profile under my user home directory. These are the only files i see in my home directory. # ls -laq total 44 drwx------ 4 user1 adm 4096 Nov 23 05:10 . drwxr-xr-x. 12 root root 4096 Nov 22 13:05 .. -rw-r--r-- 1 user1 adm 18 Nov 22 13:05 .bash_logout... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Shell Programming and Scripting

How do i call aliases from my .profile?

Hello all, Please my shell is ksh. I created .profile such that users can pick environments they want to use: echo Select your Environment!! echo " 1. Nigeria DEV" echo " 2. UEMOA DEV" echo " 3. CEMOA DEV" echo "Make your choice : \c" read choice if then ... fi if then (6 Replies)
Discussion started by: mofaloks
6 Replies

3. Infrastructure Monitoring

trap in etc/profile and user .profile

Hello I really wonder what's trap in etc/profile and in each user .profile. I try to google for it but I think I have no luck. Mostly hit is SNMP traps which I think it is not the same thing. I want to know ... 1. What's a "trap 2 3" means and are there any other value I can set... (4 Replies)
Discussion started by: Smith
4 Replies

4. UNIX for Dummies Questions & Answers

difference between /etc/profile and .profile?

What is the difference between /etc/profile and .profile? (5 Replies)
Discussion started by: gehlnar
5 Replies

5. Shell Programming and Scripting

etc aliases

Hello: i have several server with own etc aliases. right now i want to combine it all into a general etc aliases in a new freebsd server. cause it consist hundred thousand of record user inside how to make a shell script to combine it or configure it. all etc aliases record example: ... (0 Replies)
Discussion started by: peterLfs
0 Replies

6. SCO

Difference between .profile and .~/.profile

what is the difference between these two lines, if we use it in korn shell script: .profile .~/.profile (3 Replies)
Discussion started by: maneesh mehta
3 Replies

7. UNIX for Dummies Questions & Answers

aliases

Is there a way to view what aliases are running on a given session? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

8. Programming

aliases

Hi. I have a C program that is using the **environ pointer and I am trying to set up aliases for a system("/bin/ksh") call. This works for other environment variables but not for the aliases. Does anyone know if this can be done? Thanks ahead of time. (1 Reply)
Discussion started by: mluey61
1 Replies

9. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies
Login or Register to Ask a Question