SSH can't send command
up vote
0
down vote
favorite
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 user@127.0.0.1:/home/user/test/asdf.log
...
zsh:1: command not found: scp
And then sending a command:
ssh user@127.0.0.1 ls
...
zsh:1: command not found: ls
ssh user@127.0.0.1
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 root@127.0.0.1 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.
linux ssh scp
add a comment |
up vote
0
down vote
favorite
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 user@127.0.0.1:/home/user/test/asdf.log
...
zsh:1: command not found: scp
And then sending a command:
ssh user@127.0.0.1 ls
...
zsh:1: command not found: ls
ssh user@127.0.0.1
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 root@127.0.0.1 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.
linux ssh scp
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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 user@127.0.0.1:/home/user/test/asdf.log
...
zsh:1: command not found: scp
And then sending a command:
ssh user@127.0.0.1 ls
...
zsh:1: command not found: ls
ssh user@127.0.0.1
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 root@127.0.0.1 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.
linux ssh scp
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 user@127.0.0.1:/home/user/test/asdf.log
...
zsh:1: command not found: scp
And then sending a command:
ssh user@127.0.0.1 ls
...
zsh:1: command not found: ls
ssh user@127.0.0.1
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 root@127.0.0.1 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.
linux ssh scp
linux ssh scp
edited Nov 17 at 1:22
asked Nov 17 at 1:06
SilentStorm
133
133
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
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.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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.
add a comment |
up vote
0
down vote
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.
add a comment |
up vote
0
down vote
up vote
0
down vote
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.
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.
answered Nov 17 at 1:47
SilentStorm
133
133
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376136%2fssh-cant-send-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown