safe way to add aliases for another user?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
At work I have a personal account, but I'm doing development on a program which is run by a machine account. By "machine account" I just mean that it isn't tied to a person - it doesn't have any special sysadmin role, but it runs our batch jobs. This account has been around for a while and might do a lot of different things.
During development I'm doing most of my work in this account, so I wanted to setup some aliases, for example "alias e=emacs -nw".
But I'm worried if I edit the .profile-user to add these, I could mess something up. What if e is also the name of some other command it uses which I would be overriding?
So, how can I do this safely? I could just try out the aliases I want one-by-one and verify that they show "command not found" so that there wouldn't be a conflict. But I guess that doesn't account for conflicts in cases where the string might become a command under certain circumstances (e.g. the machine account has a program that cd's to a certain directory and then runs a file which happens to be the same name as my alias).
Just curious if anybody has thought about this before and knows a good way around it, or if you think I really shouldn't introduce aliases on this account.
alias
add a comment |Â
up vote
0
down vote
favorite
At work I have a personal account, but I'm doing development on a program which is run by a machine account. By "machine account" I just mean that it isn't tied to a person - it doesn't have any special sysadmin role, but it runs our batch jobs. This account has been around for a while and might do a lot of different things.
During development I'm doing most of my work in this account, so I wanted to setup some aliases, for example "alias e=emacs -nw".
But I'm worried if I edit the .profile-user to add these, I could mess something up. What if e is also the name of some other command it uses which I would be overriding?
So, how can I do this safely? I could just try out the aliases I want one-by-one and verify that they show "command not found" so that there wouldn't be a conflict. But I guess that doesn't account for conflicts in cases where the string might become a command under certain circumstances (e.g. the machine account has a program that cd's to a certain directory and then runs a file which happens to be the same name as my alias).
Just curious if anybody has thought about this before and knows a good way around it, or if you think I really shouldn't introduce aliases on this account.
alias
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
If your scripts aren't explicitely loading~/.bashrc
or setBASH_ENV
, you should be fine to add aliases.
â Richard Neumann
Dec 6 '17 at 15:18
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
2
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
At work I have a personal account, but I'm doing development on a program which is run by a machine account. By "machine account" I just mean that it isn't tied to a person - it doesn't have any special sysadmin role, but it runs our batch jobs. This account has been around for a while and might do a lot of different things.
During development I'm doing most of my work in this account, so I wanted to setup some aliases, for example "alias e=emacs -nw".
But I'm worried if I edit the .profile-user to add these, I could mess something up. What if e is also the name of some other command it uses which I would be overriding?
So, how can I do this safely? I could just try out the aliases I want one-by-one and verify that they show "command not found" so that there wouldn't be a conflict. But I guess that doesn't account for conflicts in cases where the string might become a command under certain circumstances (e.g. the machine account has a program that cd's to a certain directory and then runs a file which happens to be the same name as my alias).
Just curious if anybody has thought about this before and knows a good way around it, or if you think I really shouldn't introduce aliases on this account.
alias
At work I have a personal account, but I'm doing development on a program which is run by a machine account. By "machine account" I just mean that it isn't tied to a person - it doesn't have any special sysadmin role, but it runs our batch jobs. This account has been around for a while and might do a lot of different things.
During development I'm doing most of my work in this account, so I wanted to setup some aliases, for example "alias e=emacs -nw".
But I'm worried if I edit the .profile-user to add these, I could mess something up. What if e is also the name of some other command it uses which I would be overriding?
So, how can I do this safely? I could just try out the aliases I want one-by-one and verify that they show "command not found" so that there wouldn't be a conflict. But I guess that doesn't account for conflicts in cases where the string might become a command under certain circumstances (e.g. the machine account has a program that cd's to a certain directory and then runs a file which happens to be the same name as my alias).
Just curious if anybody has thought about this before and knows a good way around it, or if you think I really shouldn't introduce aliases on this account.
alias
asked Dec 6 '17 at 15:05
Stephen
1245
1245
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
If your scripts aren't explicitely loading~/.bashrc
or setBASH_ENV
, you should be fine to add aliases.
â Richard Neumann
Dec 6 '17 at 15:18
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
2
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50
add a comment |Â
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
If your scripts aren't explicitely loading~/.bashrc
or setBASH_ENV
, you should be fine to add aliases.
â Richard Neumann
Dec 6 '17 at 15:18
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
2
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
If your scripts aren't explicitely loading
~/.bashrc
or set BASH_ENV
, you should be fine to add aliases.â Richard Neumann
Dec 6 '17 at 15:18
If your scripts aren't explicitely loading
~/.bashrc
or set BASH_ENV
, you should be fine to add aliases.â Richard Neumann
Dec 6 '17 at 15:18
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
2
2
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I'm assuming that the "machine account" is not typically used interactively but that it's an account that runs various services.
Adding aliases to the account's .profile
should then be safe as this file is only read by login shells.
Aliases are furthermore not inherited by child processes, so if you log in to the account and start a script or program from the command line, then the alias in the .profile
file will not be defined for that script or program, unless it explicitly sources the .profile
file directly or indirectly (which it should not do).
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I'm assuming that the "machine account" is not typically used interactively but that it's an account that runs various services.
Adding aliases to the account's .profile
should then be safe as this file is only read by login shells.
Aliases are furthermore not inherited by child processes, so if you log in to the account and start a script or program from the command line, then the alias in the .profile
file will not be defined for that script or program, unless it explicitly sources the .profile
file directly or indirectly (which it should not do).
add a comment |Â
up vote
0
down vote
I'm assuming that the "machine account" is not typically used interactively but that it's an account that runs various services.
Adding aliases to the account's .profile
should then be safe as this file is only read by login shells.
Aliases are furthermore not inherited by child processes, so if you log in to the account and start a script or program from the command line, then the alias in the .profile
file will not be defined for that script or program, unless it explicitly sources the .profile
file directly or indirectly (which it should not do).
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I'm assuming that the "machine account" is not typically used interactively but that it's an account that runs various services.
Adding aliases to the account's .profile
should then be safe as this file is only read by login shells.
Aliases are furthermore not inherited by child processes, so if you log in to the account and start a script or program from the command line, then the alias in the .profile
file will not be defined for that script or program, unless it explicitly sources the .profile
file directly or indirectly (which it should not do).
I'm assuming that the "machine account" is not typically used interactively but that it's an account that runs various services.
Adding aliases to the account's .profile
should then be safe as this file is only read by login shells.
Aliases are furthermore not inherited by child processes, so if you log in to the account and start a script or program from the command line, then the alias in the .profile
file will not be defined for that script or program, unless it explicitly sources the .profile
file directly or indirectly (which it should not do).
answered Jan 10 at 14:25
Kusalananda
104k14206324
104k14206324
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409234%2fsafe-way-to-add-aliases-for-another-user%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Check the return status of the type command for the aliases in question i.e. "type e" This will tell you whether you can set them up or not.
â Raman Sailopal
Dec 6 '17 at 15:16
If your scripts aren't explicitely loading
~/.bashrc
or setBASH_ENV
, you should be fine to add aliases.â Richard Neumann
Dec 6 '17 at 15:18
Question based on the other question Richard linked to: How does bash decide if the shell is "interactive"? Couldn't my machine account be running in interactive mode, like for example if a job server logs in under the machine account to run the jobs?
â Stephen
Dec 6 '17 at 15:23
2
Either create a new user for yourself, or put your own aliases & functions in a separate file and load them from there when starting a shell. Really, if you run interactive shells on a system, you do want to have personal configuration files for the shells. (not just aliases but prompts and shell settings too.)
â ilkkachu
Dec 6 '17 at 16:17
What I was thinking is if there's a way to say "if the user which sudo'd to this user = myrealusername, alias xyz." That way it would be guaranteed to only be invoked if it's me running this particular user.
â Stephen
Dec 7 '17 at 15:50