3

i set up to use ssh between two hosts without password.

ssh log in is working fine but execute commands failed with the below erro:

**isn't allowed to be executed with process or redirect controls.**

Simple command used:

ssh remo-tehost " echo \"\test\"  >> \"/home/alarmstest.log\" "

Running trace i got:

debug1: Sending command:  echo "test"  >> "/home/alarmstest.log" 
debug2: channel 0: request exec confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug2: channel 0: rcvd ext data 117

there is sudosh on the remote server for the user used user:x:500:500::/home/user:/usr/local/bin/sudosh authorized_keys from the remote server + key inside -rw------- 1 user user 9092 Dec 13 07:53 authorized_keys

5
  • ssh working fine, however running ssh with commands not working ... not the same case in this question Commented Dec 16, 2014 at 9:42
  • What happens if you prefix your command with "-t" ?
    – Andy
    Commented Dec 16, 2014 at 10:05
  • ssh -t remo-tehost " echo \"\test\" >> \"/home/alarmstest.log\" " output " echo "\test" >> "/home/alarmstest.log" " isn't allowed to be executed with process or redirect controls. Connection to remote-host closed. Commented Dec 16, 2014 at 10:16
  • I would check the "PermitTTY" setting on the server, usually found in "/etc/ssh/sshd_config".
    – JdeHaan
    Commented Dec 16, 2014 at 10:46
  • Does the remote system have sudosh installed? Does the remote user have that as the shell, or is it a forced command? Show the remote authorized_keys file (add the additional info to your question, don't put it in a comment).
    – wurtel
    Commented Dec 16, 2014 at 12:09

2 Answers 2

0

This appears to be an issue with quoting. Simply remember that whenever you want to execute a shell command over ssh then it is received by the remote shell (e.g. Bash) as, /bin/bash -c <command-line>. You need to have only one pair of quotes:

ssh remo-tehost "echo test  >> /home/alarmstest.log"

This pair is important to prevent the local shell, that is, the one you using to executing the command-line, from interpreting the parameters.

3
  • [user@local-host ~]$ ssh remote-host"echo test >> /home/alarmstest.log" "echo test >> /home/alarmstest.log" isn't allowed to be executed with process or redirect controls this issue is on the remote host, i test this with old server as remote host and worked fine Commented Dec 18, 2014 at 11:36
  • What is the shell that you log into by default on the remote host? Is it /bin/bash or something else?
    – pdp
    Commented Dec 18, 2014 at 11:49
  • **isn't allowed to be executed with process or redirect controls. is there any solution to this? on remote server it is -bash (/usr/bin/bash) shell, i have got it by echo $0 command
    – axnet
    Commented Mar 28, 2019 at 5:15
0

issue due to permission on home directory:

home directory ~, ~/.ssh directory and ~/.ssh/authorized_keys file on the remote host must be writable only by the user used 700 or 755, 775 will not work.

private key file (on the local host) neet to be readable and writable only by the user used: rw——-, 600.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .