SSH

From miki
Revision as of 13:02, 9 September 2008 by Mip (talk | contribs) (→‎SSH Console: Remote command execution)
Jump to navigation Jump to search

SSH GUI

Gnome/Nautilus

  • Under Gnome, one can uses menu PlacesConnect to Server... to connect to a remote server in Nautilus. The connection can be bookmarked for future use.
  • The syntax for address bar in Nautilus is sftp://username@server/folder.

KDE/Konqueror

  • Use KIO fish or sftp to establish a SSH or SFTP connection in Konqueror.

gftp

  • gftp is a free multithreaded file transfer client for *NIX based machines. It supports the FTP, FTPS (control connection only), HTTP, HTTPS, SSH and FSP protocols.

SSH Console

Remote Command Execution

  • SSH allows to execute any command on remote SSH host. The syntax is
% ssh -t SSH_HOST COMMAND
  • To execute a remote command on remote host and stay connected afterwards, use ssh -t, along with bash rcfile, like:
% ssh -t SSH_HOST "bash --rcfile PATH_TO_RC_FILE"

Don't miss the quotes around the command. Bash will execute the commands in the rc file, and will open a session. Connection remains open because stdin/stdout is not closed. Option -t allows for connecting with current terminal. Without this option, there will be no terminal connection, so bash would run in batch mode (no prompt), and terminal features like tab completion or color would be missing.

  • Another solution is to force bash interactive mode:
 % ssh SSH_HOST "bash --rcfile PATH_TO_RC_FILE -i"

But this is only a partial solution. The prompt will then be printed, but still there will be no terminal, ie. no color, no TAB auto-completion.

Troubleshooting

  • ~/bin/ssh.pl from ssh-tunnel package currently interferes with the command, stripping everything after the --. Current solution is to remove ssh.pl from the path.