2

I ran an X app sudo'ed from my normal account, using:

mylappy$ ssh -Y me@myhost.com
    me@myhost.com's password:
[me@myhost ~]$ sudo su - 
[root@myhost ~]# su - me -c 'xauth list' |\
     grep `echo $DISPLAY |\
         cut -d ':' -f 2 |\
         cut -d '.' -f 1 |\
         sed -e s/^/:/`  |\
     xargs -n 3 xauth add

Now, whenever I try to ssh in with the -Y flag, I get this error.

mylappy$ ssh -Y me@myhost.com
me@myhost.com's password: 
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
                                                                                                                   shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
                                                        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
                                                                                                                                                                           Last login: Fri Apr 17 17:43:14 2015 from my.isp.com

Clearly, running this app as root wrote something somewhere that subsequent ssh sessions as me aren't able to execute because it is root-related.

I cleaned out ~/.gnome and anything else that looked suspicious in ~. Nuked .Xauthority.

I tried running /etc/profile, /etc/bashrc, ~/.bashrc, ~/.bash_profile to see if anything there was throwing this error. Nope.

[me@myhost ~]$ . /etc/profile           
[me@myhost ~]$ . /etc/bashrc
[me@myhost ~]$ . ~/.bash_profile 
[me@myhost ~]$ . ~/.bashrc

Where else would ssh -Y be executing things from that might throw this error?

Note, this does not happen without the -Y flag.

1 Answer 1

1

from the sshd manpage:

If ~/.ssh/rc exists and the sshd_config(5) PermitUserRC option is set, runs it; else if /etc/ssh/sshrc exists, runs it; otherwise runs xauth. The “rc” files are given the X11 authentication protocol and cookie in standard input. See SSHRC, below.

1
  • well, it turns out it was the .Xauthority on my local machine (laptop connecting to myhost.com) that was the problem! Removed that, error went away.
    – adapt-dev
    Apr 18, 2015 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.