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.

  • 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. Dec 6, 2017 at 15:16
  • If your scripts aren't explicitely loading ~/.bashrc or set BASH_ENV, you should be fine to add aliases. Dec 6, 2017 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, 2017 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, 2017 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, 2017 at 15:50

1 Answer 1


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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .