Using Finder to connect to a remote host over SSH
If you do want to be able to use Finder to access remote systems over SSH then you will need osxfuse and sshfs:
brew install osxfuse sshfs
Make sure you reboot your mac after installing osxfuse
. Also you might need to grant permissions for the extension to work.
Now you should be able to mount your remote to a local folder:
sshfs -p 22 [email protected]:/ ~/your-local-mount-folder -oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname=my_sshfs_mount
And now you should be able to browse the remote system with finder: open ~/your-local-mount-folder
.
Copying files over SSH
OOTB you can copy a file or a folder recursively over ssh with:
# local to remote
scp -r <local-file-or-folder> <remoteuser>@<remotehost><remotepath>
# remote to local
scp -r <remoteuser>@<remotehost><remotepath> <local-file-or-folder>
# copy 'mydir' on the local machine to the home folder on the remote
scp -r mydir [email protected]:
# copy 'mydir' on the local machine to the '/tmp' folder on the remote
scp -r mydir [email protected]:/tmp
If the remote host is a Mac, then under System Preferences > Sharing > Remote Login must be enabled.
The remote folder is relative to the home, therefore to copy a file/folder to ~/.config
on the remote host you can use:
scp -r mydir [email protected]:.config
The -r
flag stands for recursive and is needed to recursively copy folders; not necessary for single files.
Connecting with Finder over samba
Finder does not support OOTB mounting over ssh, but you can use samba instead.
IF the remote host is a Mac then under System Preferences > Sharing > File Sharing must be enabled.
Now you can use Finder > menu item Go > Connect to Server and connect via the name as displayed in the system prefs Sharing dialog, e.g. smb://yourusername.home
or the IP address e.g. smb://192.168.1.123
.
Connecting over Midnight Commander (ssh)
If you want a simple text GUI then you also have the option of Midnight Commander:
brew install mc
Once installed, run Midnight Commander by launching mc
from your terminal, then from the menu pick e.g. Left > Shell link and enter your remote host either as [email protected]:
or the alias you configured in your ~/.ssh/config
(don't forget the trailing colon at the end.)
HINT: To emulate the F-keys for mc
in your terminal you can use the Esc+1..9
sequences.
NOTE
scp
, sftp
, sshfs
and mc
will all honour the aliases you have in your ~/.ssh/config
so you can use them instead of long strings like [email protected]