Web Hosting Forum | Lunarpages

Author Topic: How to login to your dedicated server via SSH  (Read 71156 times)

Offline abhilash

  • Intergalactic Cowboy
  • *****
  • Posts: 61
How to login to your dedicated server via SSH
« on: May 15, 2005, 01:14:43 AM »
What is SSH
                                                                               
The Secure Shell protocol (SSH1) was originally developed in 1995 by Mr. Tatu Ylonen to overcome the risks of sending plain-text passwords when connectiing to remote servers over TCP/IP networks.
                                                                               
SSH protocol provides a means for connecting to remote machines via an encrypted network channel. SSH is now the standard security protocol used by millions world-wide for secure login, remote command execution and file transfer over TCP/IP networks.
                                                                               
Why SSH
                                                                               
SSH protocol is intended as a replacement for telnet, rlogin, rsh, and rcp. BSD's r-utilities are considered unsafe for various reasons. For SSH2, there is a replacement for FTP: sftp.
                                                                               
When to SSH

When ever you need to accomplish tasks at your dedicated server. Tasks may be like editing a file, installing a firewall, changing the permissions of file and so on.

SSH1 and SSH2
===============

                                                                               
You may have heard of SSH2 in the tutorial at http://www.lunarforums.com/viewtopic.php?t=26253 Please do follow the tutorial.
                                                                               

SSH2 is the current version of the Secure Shell protocol. SSH2 is a complete rewrite of the SSH1 with improvements to security (uses different encryption and authentication algorithms) , performance, and portability. SSH2 also provides added functionality. Most notably, it adds the sftp program to the SSH suite.

SSH1 has documented vulnerabilities, including susceptibility to a variant of the cryptographic man-in-the-middle attack.

How to use SSH
================


You should have SSH server installed and started on the remote server you wish to login to (99.99% it is pre-installed on your linux server) and an SSH Client

SSHD Server
=============

Mostly, you don't need to do anything here. SSH server will be started by default, by the time, we send you the account information.
                                                                               
You can test it by telneting to port 22 and if running you should see something similar to

If you are using Windows, you can telnet by

Start --> Run --> cmd --> telnet 192.168.0.1 22

You should see something similar to one like
Code: [Select]
SSH-2.0-OpenSSH_3.6.1p2

OR

Code: [Select]
[abhilash@athena LP]$ telnet 192.168.0.1 22
Trying 192.168.0.1...
Connected to 192.168.0.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_3.6.1p2

                                                                               
If SSHD server is not running, you will see as below or telnet session will just hang in there.
                                                                               
Code: [Select]
[abhilash@athena LP]$ telnet 192.168.0.1 22
Trying 192.168.0.1...
telnet: connect to address 192.168.0.1: Connection refused


or on a windows machine,

Code: [Select]
C:\DOCUME~1\ABHILASH> telnet 192.168.0.1 22
Connecting To 192.168.0.1...Could no open connection to the host, on port 22. No connection could be made becaue the target machine actively refused it.


You may proceed to SSH Client section, if you find that SSH is running. Or else you may restart the server
                                                                               
a. Using Webmin
                                                                               
1. Login to webmin as root or the webmin user we have provided you.
2. Top Menu --> Others --> Command Shell
3. In the textbox to the side of "Execute command" type --> /etc/init.d/sshd start and if webmin says, it mean it :-)
                                                                               
Code: [Select]
Starting sshd:        [  OK  ]
                                                                               
b. Using Cpanel
                                                                               
1. Login to cpanel at https://yourservername.tld:2087
2. Scroll down the menu to bottom left where you see "Restart Services" and Click the link "SSH Server (OpenSSH)"
                                                                               
SSH Client
==========


Linux/Unix version
                                                                               
Do you really need a URL to download ? :-) Use the one coming with your OS.
                                                                               
Windows Versions
                                                                               
1] Official SSH : http://ftp.ssh.com/pub/ssh/SSHSecureShellClient-3.2.9.exe
2] Putty : http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
3] WinSCP : http://winscp.net/eng/index.php {Drag and Drop your files to server}
4] http://sshwindows.sourceforge.net/ {Once installed, you get all the SSH commands}


You have to download the applications mentioned in 1], 2] or 4] for getting terminal access which will enable you to edit the files and enter the shell commands mentioned elsewhere in this forum. You may use WinSCP for getting an explorer like interface of your linux server (http://winscp.net/eng/docs/screenshots)
                                                                               
Note: If you login as root to copy or create files, the ownership will be under root and not the username. Use the command "chown username.username path/to/filename" to change the ownership to username.


                                                                               
SSH to server with Putty
======================


Please refer http://the.earth.li/~sgtatham/putty/0.58/htmldoc/ for a detailed howto on using Putty.
                                                                               
1. Download putty from one of the links available at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
                                                                               
2. Double click the icon on your Desktop to launch PuTTY.
                                                                               
3. When you first launch the PuTTY program, you should be at the main PuTTY Configuration screen as shown below
                                                                               

                                                                               
You have to the HostName [or IP address], where I entered 192.168.0.1  with your server's IP.
                                                                               
4. If you see something like, below, don't panic. Visit the download page, mentioned above and download one of the development versions available.
                                                                               

                                                                               

5. Now you have PuTTY ready to go. For the first time, you may see a PuTTY Security Alert as below,

                                                                               
Click Yes :-) and you will have a login screen
                                                                               
6. Once you enter the exact login details of root or a userid you have created, you are inside your dedicated server box :-) and are free to execute the commands. Do play around with the basic shell commands available at http://www.lunarforums.com/viewtopic.php?t=26162
                                                                               

                                                                               
SSH to server using Official SSH client
==================================

1. Download and install the client available at http://ftp.ssh.com/pub/ssh/SSHSecureShellClient-3.2.9.exe
                                                                               
2. Once the is on your desktop, double click it.
                                                                               
3. A window similar to below will be shown
                                                                               

                                                                               
4. Now start by clicking the to get a screen as below,
                                                                               

                                                                               
Enter your dedicated server's hostname/ip address and root where you see 192.168.0.5 and root in the image respectively.

5. You should get an alert as --> for host  identification, where you can save the host key of your dedicated server.
                                                                               
6. You will be asked for password and enter it.

7. On sucessfull login you will get a screen as below

                                                                               
and you will be asked for giving a name to this session. Give one. It will save a few fingering later, as seen in Step 8
                                                                               
And now you have the shell, where you can execute the commands as seen below,
                                                                               


8. For reconnecting to your dedicated server Choose Profiles --> Profilename as in



:thumb: Great guys..Now it's time to explore your Linux server :-)

References
[1] http://www.ciac.org/ciac/bulletins/m-017.shtml
[2] http://the.earth.li/~sgtatham/putty/0.58/htmldoc/
Abhilash

JSA Supervisor - System Admin Team

Offline thejake420

  • Intergalactic Cowboy
  • *****
  • Posts: 58
  • Jakes Jokes - The largest joke site on the web!
    • Jakes Jokes
Re: How to login to your dedicated server via SSH
« Reply #1 on: June 15, 2007, 07:07:39 AM »
I've tried (for many MANY hours) to get this working, but to no avail.

I've got PuTTY, but can't seem to get the actual connection. When I try logging on (even through the CPanel javascript version, etc.) I get to the login part... username is simple enough, but it never accepts my password.

Am I supposed to be typing in my passphrase or am I missing something obvious (which is likely)?

Also, where do I copy and paste whatever...? I can get one, but not both. I've looked everywhere, but all I can find are tutorials based on the assumption that you've generated a pair of keys and that you know how to use them. (I don't know what I'm doing... have decent web experience, but never had to deal with SSH, and have NEVER been able to get the concept of public and private keys working for anything.)


Jake
« Last Edit: June 15, 2007, 07:11:51 AM by thejake420 »
Webmaster - JakesJokes.com
Jokes
Funny videos
Funny pictures

Offline perestrelka

  • Master Jedi
  • *****
  • Posts: 1397
Re: How to login to your dedicated server via SSH
« Reply #2 on: June 16, 2007, 09:14:50 PM »
Hi Thejake420,

Do you have any control panel installed on the server? Which user are you trying to SSH in?

Key based authentication manuals would be useful only if you setup keys on your account on the server. If you didn't do that, then you will be able to login only with login and pass of existing user.
Kind Regards,
Vlad Artamonov

Offline jimlongo

  • Intergalactic Superstar
  • *****
  • Posts: 153
    • Rhythm Division
Re: How to login to your dedicated server via SSH
« Reply #3 on: April 10, 2009, 07:08:27 AM »
Hi, and thanks for your detailed instructions on ssh for Windows users.

I've been reading the man pages for ssh on Mac OSX (BSD), could someone kindly explain which of the following details are necessary for login to my dedicated server using the terminal.

Code: [Select]
SYNOPSIS
     ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [-D
         [bind_address:]port] [-e escape_char] [-F configfile] [-i identity_file] [-L
         [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd]
         [-o option] [-p port] [-R  [bind_address:]port:host:hostport] [-S ctl_path]
         [-w local_tun[:remote_tun]] [user@]hostname [command]

« Last Edit: April 10, 2009, 09:37:16 AM by jimlongo »

Offline perestrelka

  • Master Jedi
  • *****
  • Posts: 1397
Re: How to login to your dedicated server via SSH
« Reply #4 on: April 11, 2009, 01:22:39 AM »
Hi, and thanks for your detailed instructions on ssh for Windows users.

I've been reading the man pages for ssh on Mac OSX (BSD), could someone kindly explain which of the following details are necessary for login to my dedicated server using the terminal.

Code: [Select]
SYNOPSIS
     ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [-D
         [bind_address:]port] [-e escape_char] [-F configfile] [-i identity_file] [-L
         [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd]
         [-o option] [-p port] [-R  [bind_address:]port:host:hostport] [-S ctl_path]
         [-w local_tun[:remote_tun]] [user@]hostname [command]


For SSH terminal in a UNIX system, you need to use the following command to ssh to the server (don't forget top put the appropriate values instead what is mentioned in square brackets):

ssh [username]@[hostname.or.host.ip.address]

It will ask you to confirm the server fingerprint before asking the password.
Kind Regards,
Vlad Artamonov

 

Share |