0

Description

I first encountered this problem when I tried to use SCP to another computer over LAN, and get zsh:1: command not found: scp
Now before anyone asks: yes I have SSH installed.
I can use ssh to log into the other computer just fine.
The problem is SCP, and ssh [user@]hostname [command] both result in zsh:1: command not found: [command].

Testing

I tried using SCP with localhost

systemctl start sshd.service scp /home/user/asdf.log [email protected]:/home/user/test/asdf.log ... zsh:1: command not found: scp 

And then sending a command:

ssh [email protected] ls ... zsh:1: command not found: ls 

ssh [email protected] works as expected.

I used the -v switch, and the info looked normal.
I tried switching to Bash instead of ZSH; same error.

Finally, I tried root login, and that worked

ssh [email protected] ls ... Desktop Documents Music ... 

SSH Config:

~/.ssh/config: nothing

#/etc/ssh/sshd_config PermitRootLogin yes # this is bad; for testing only AuthorizedKeysFile .ssh/authorized_keys ChallengeResponseAuthentication no UsePAM yes PrintMotd no #pam does that Subsystem sftp /usr/lib/ssh/sftp-server 

Using Arch Linux with openssh 7.9p1

TL;DR

It looks like the environment isn't getting set (not even PATH) for SCP and single command SSH. But, for root login it is getting set properly.
Any ideas about this?

Update

It's something with my user shell config.
I added a new, blank user account, and using SCP into that worked fine.

1 Answer 1

0

I figured out the problem.

There was a line in my ~/.pam_environment setting my path.
PATH DEFAULT=${PATH}:/home/@{PAM_USER}/bin
This for some reason puts /home/user/bin in my path 3 times, and adds an extra colon.
Why it does this, I'm not sure.
But setting my PATH in ~/.profile instead, fixed the problem.

I guess, the bad PATH assignment was discarded by ssh, but not by my regular login.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.