Can administrators know what commands I execute non-interactively through SSH?
For example: does
echo hello get logged somewhere at
remote if I run this?
$ ssh me@remote "echo hello"
Can remote commands be otherwise monitored?
The administrator could install a modified sshd that records everything from all ssh sessions, interactive or not.
The question is: Do you trust the administrator of the remote system?
If you want to hide the command from the ps list, eg a password, encapsulate it into a script, then copy the script over and execute it.
cat > blah.sh << EOF #!/bin/bash some commands here EOF scp blah.sh targethost:~ ssh targethost ./blah.sh
This would also prevent any finagling that eg records all commands run. Anyone monitoring would just know that 'blah.sh' was run, not what was in it. Assuming you remove it afterwards.
Yes, It is possible. there are several ways to do this. you can simply record a session by using
script command. There are several commercial tools such as observeit to get lot more detail.
I think depending on a setup a user can be restricted to figure out if their session been recorded either non-interactive or interactive.
Yes. On the remote host its recorded on /var/log/secure. You'll need sudo to view this log file.