-1

Logging into my work station over SSH, I notice that none of my aliases work. Sure enough:

$ alias
$ source ~/.bashrc
Could not open a connection to your authentication agent.

So I googled the error message, but all the information that I could find relate to users of Cygwin or Putty logging into their Linux machines. In my case, I'm logging in from one Linux machine (Kubuntu 12.10) to another (Kubuntu 13.04). Also, I can actually log in and run commands. I just cannot source ~/.bashrc!

I ask here instead of on unix.SE as this seems more of a "connecting to remote machine properly" issue, which is very relevant to servers. As per the Help Center this seems on-topic. If mods feel that unix.SE is more appropriate, then I have no problems moving the question there.

Note that I tried to source ~/.bashrc because I had suspected that the aliases were not defined due to .bashrc not being read on SSH logins.

dotancohen
  • 2,410
  • 2
  • 24
  • 38
  • Why the downvote? How can I improve the question? Is there any important information that I did not include? – dotancohen Jun 16 '13 at 10:50
  • What's in the `.bashrc`? Anything related to SSH key management (`ssh-add`)? – Sven Jun 16 '13 at 10:55
  • @SvW: Actually, I do have `ssh-add /some/file.pem` in .bashrc. Commenting that out fixed it! Please post your comment as an answer so that I could accept it. Thanks! – dotancohen Jun 16 '13 at 11:08
  • Tracing execution of Bash scripts can be helpful in diagnosing this type of problem. See [this](http://serverfault.com/questions/16204/how-to-make-bash-scripts-print-out-every-command-before-it-executes) and [this](http://stackoverflow.com/questions/5014823/how-to-profile-a-bash-shell-script/5015179#5015179). – Dennis Williamson Jun 16 '13 at 11:30

2 Answers2

1

This error message suggests that you have issues with connections to the SSH agent from inside the ~/.bashrc. Remove any calls to ssh-add from it and test again. If that fixes your problem, you can hunt for the root cause of the agent problem.

Sven
  • 97,248
  • 13
  • 177
  • 225
0

I'm not sure what you're trying to do with 'source'.

Add aliases to your ~/.bashrc and restart your session for them to work. If they don't, then provide the error symptoms.

Peter
  • 1,450
  • 2
  • 15
  • 26
  • He noticed that his aliases don't work, confirmed that none are defined with `alias`, tried to include them manually with sourcing `.bashrc` and got the error message while doing so. So, this *are* the error symptoms. – Sven Jun 16 '13 at 11:02
  • I had suspected that the aliases were not defined due to [`.bashrc` not being read on SSH logins](http://unix.stackexchange.com/questions/62373/bash-config-files-being-read-in-contradiction-to-man-bash). – dotancohen Jun 16 '13 at 11:06