Setting up the secure tunnel using Terminal in Mac OS X
When using Terminal to create the SSH tunnel, you enter a command that forwards a specific local port to port 21. Because port 21 (the default FTP port) is a privileged port, changing this port setting requires super user access. Therefore, you must either log in as root to perform this change, or you must use the sudo command to call up super user access. We will be using the latter method in this example.
- Open Terminal (Macintosh HD : Applications : Utilities : Terminal).
- The command below provides an example of the SSH command that creates the tunnel. This code will need to be customized using the desired local port and remote host information. The part that must be customized is in red:
sudo ssh -L local port number :hostname
[or ip address :21] user@mysite.com
To customize the formula above, let's add a local port number (any available local port), remote host name and remote login info (login or username followed by "@" + host name and domain name):
sudo ssh -L 2021:www.mysite.com:21 username@www.mysite.com
Note: This command must be entered as one line with no linebreaks.
- After entering the command to create the tunnel, you will be prompted to enter the password for your local account. Type in your local account's password and press enter.
- You will now be prompted to enter your password for the remote host. Type in the password and press enter.
Note: A message, such as "Host key unknown", may appear when
connecting to a host for the first time. This warning occurs when
connecting to a new host. This warning can also occur when changes have
been made to a previously-saved connection. Type Yes to continue.
|