Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • I'm not logging in as root, it's an AWS server so I have to login as "ec2-user" then change to root using "sudo su -". So should I put the commands in "/home/ec2-user/.bashrc"?
    – Alasdair
    Commented Nov 8, 2011 at 6:45
  • 5
    This assumes ~/.bashrc is sourced from your ~/.bash_profile. ~/.bash_profile will be the script that is invoked for a login shell like ssh. I believe ~/.bashrc will get called if you open up a Gnome Terminal, for example, AFTER having already logged in.
    – dgrant
    Commented Nov 8, 2011 at 6:46
  • You've confused me, let me explain more: This is an Amazon Web Services instance, which is a virtually server, so no one will ever physically log in (I'm not even sure if it physically exists as one machine). I login using PUTTY with the username ec2-user. This drops me in /home/ec2-user directory. I then change to root user by typing "sudo su -", which then drops me into "/root", then I have to type a series of commands, including changing me back to "/home/ec2-user" and setting some variables, aliases, etc. So... how would I get it to do this?
    – Alasdair
    Commented Nov 8, 2011 at 6:52
  • Also, since I am changing user, I expect that in the ec2-user bash profile I should put only "sudo su -", and then the rest of the commands in the root bash file?
    – Alasdair
    Commented Nov 8, 2011 at 6:52
  • NOTE: actually, it's .profile that gets called if it exists, unless .bash_profile, exists, then it is called instead.
    – dgrant
    Commented Nov 8, 2011 at 6:52