Correct syntax for using SSH and SFTP on Ubuntu on irregular ports
I’m posting the following more for my own benefit and reference than anything else…
Correct syntax for SSH and SFTP on Ubuntu on irregular ports: (replace items in < > with your stuff, without the < >)
SSH:
ssh -p <port number> <username>@<server name>
SSH to accept socks 5 proxy on port you specify:
ssh -p <port number> <username>@<server name> -D <port to watch>
SFTP:
sftp -oPort=<port number> <username>@<server name>
Forward the X server from your remote box:
ssh -X -p <port number> <username>@<remote computer>
Unless your are a Linux geek or have some remote Linux servers you will probably never use this, but in case you do it sure is handy…
Next week we will dive into how to create a SSH tunnel (shunnel) using your Ubuntu box at home.
October 6th, 2006 at 1:07 pm
This is helpful, and the reason I post HOWTOs on my site, to help me remember!
Also, I use scp constantly to move things from work to my home server, but switches are different than those in ssh *and* cp! Ah, the inconsistent ways of *nix. So, following your above sftp example
scp (put):
scp -P -r @:
scp (get):
scp -P -r @:
Pretty self explaniotry, but the -r is for recursive, just like cp’s -R.
October 6th, 2006 at 1:10 pm
Ah, that didn’t work, the brackets were stripped. Ok, how about {}’s
scp (put):
scp -P {port} -r {files_or_directory} {username}@{servername}:{target_directory}
scp (get):
scp -P {port} -r {username}@{servername}:{files_or_directory} {target_directory}
October 6th, 2006 at 4:55 pm
scp (and sftp) is fine for one or two files, but you might want to look at rsync for lots-o-files and/or directories. I’ll leave reading “man rsync” to the user, but to use rsync with remote irregular ports, you might do something like this:
rsync (put):
rsync -avuzb –rsh “ssh -p{port}” {/path/to/local/files_dirs} {user}@{host}:{/path/to/remote}
rsync(get):
rsync -avuzb –rsh “ssh -p{port}” {user}@{host}:{/path/to/remote} {/path/to/local}