Ubuntu12.04 SSH Login

Source: Internet
Author: User
Tags openssh server ssh port ssh server

Http://www.haogongju.net/art/2031109 compilation hadoop eclipse plugin

Set the root password:

Sudo passwd

Enter the logon password,

Set the root password.

Duplicate Root Password

Su

Log on to root.

Ubuntu does not containOpenSSH server, But onlyOpenSSH Client.OpenSSH serverInstallation Method:

sudo apt-get install openssh-server

After the OpenSSH-server is installed, you can use SSH to connect to Ubuntu.

Root @ hostname :~ # Sudo UFW disable firewall is automatically disabled when the system is started
When the Ubuntu firewall is enabled, You can ping but cannot log on to it through SSH.

Root @ hadoop-slave2:/home # UFW Enable Firewall
Firewall is active and enabled on system startup
Root @ hadoop-slave2:/home # UFW Status view Firewall Status
Status: Active
Root @ hadoop-slave2:/home # UFW disable Firewall
Firewall stopped and disabled on system startup
Root @ hadoop-slave2:/home # UFW status
Status: inactive

I cloned the original Ubuntu system.

Now you want to change the main directory of the username and login name

Hadoop-slave2 @ slave2 :~ $ Su
Password:
Root @ slave2:/home/hadoop-slave2 # cd
Root @ slave2 :~ # Vi/etc/hostname
Root @ slave2 :~ # Hostname
Slave3
Root @ slave2 :~ # Usermod-l slave3-D/home/slave3-M hadoop-slave2
Usermod: User hadoop-slave2 is currently logged in to this I still cannot directly use the current user to change its home directory.

It is said that the recovery mode is changed.

Http://hi.baidu.com/iopcajofaabcsud/item/b491c333ef47bbf62684f429

I created a new user, slave3.

Sudo adduser slave3 # note that adduser is not useraddsudo passwd myusername # Set the initial password

Then delete the slave2 user.

The following uses newuser to replace the user account to be deleted under the root user: userdel-r newuser under the Common User: sudo userdel-r newuser

There is also an SSH server configured on the Internet. Write it down first

Reprinted: http://www.163ns.com/zixun/post/5213.html

How to configure an SSH server in Ubuntu

Environment

OS: Ubuntu 12.04

1. Install the server:

Sudo apt-Get Install SSH OpenSSH-server ssh-import-ID client: www.163ns.com @ Linux :~ $ Sudo apt-Get install OpenSSH-Client

2. Configure 2. 1. Modify the default ssh port of the SSH port to 22, which is too eye-catching. We recommend that you change it to another port, such as 3301. Modify the/etc/ssh/sshd_config file

# Restart the SSH service after port 22 is changed to port 3301.

Www.163ns.com @ Linux :~ $ Sudo/etc/init. d/ssh restart

3. There are two methods to log on to the SSH server: password and key file. 3. 1. log on with a password

Www.163ns.com @ Linux :~ $ SSH testuser@192.168.56.101-p3301testuser@192.168.56.101's password: Welcome to Ubuntu 12.04 lts (GNU/Linux 3.2.0-23-generic-pae i686)

* Documentation: https://help.Ubuntu.com/

System information as of Thu May 17 00:31:21 CST 2012

System load: 0.0 processes: 73 usage of/: 9.1% of 19.18 GB users logged in: 1 memory usage: 14% IP address for eth0: 192.168.56.101 swap usage: 0%

Graph this data and manage this system at https://landscape.canonical.com/

Last login: Thu May 17 00:22:04 2012 from 192.168.56.1. If you see such information, the logon is successful. This method is relatively simple, but the security is slightly poor. . Public Key-Private Key login is first executed on the terminal

Www.163ns.com @ Linux :~ $ Ssh-keygen-T rsagenerating public/private RSA key pair. enter file in which to save the key (/home/Jim /. SSH/id_rsa): Enter passphrase (empty for no passphrase): // enter your passphrase password. Enter same passphrase again later: your identification has been saved in/home/Jim /. SSH/id_rsa.your public key has been saved in/home/Jim /. SSH/id_rsa.pub.the key fingerprint is: B9: 8f: 4b: e4: A8: 39: 9d: 57: DF: CB: 4E: 6c: 79: 76: DB: 7f www.163ns.com @ linuxthe key's randomart image is: + -- [RSA 2048] ---- + |. | S | + .... |... +... = + |. oo .. o. +. OE | o .. o... + O = | + ----------------- + www.163ns.com @ Linux :~ $ Upload Public Key

Www.163ns.com @ Linux :~ $ Ssh-copy-ID "-P 3301-I ~ /. Ssh/id_rsa.pub testuser@192.168.56.101 "Warning: Identity file ~ /. Ssh/id_rsa.pub not accessible: no such file or directory.testuser@192.168.56.101's password: Now try logging into the machine, with "ssh '-P 3301-I ~ /. Ssh/id_rsa.pub testuser@192.168.56.101 '", and check in:

~ /. Ssh/authorized_keys

To make sure we haven't added extra keys that you weren't expecting.

Www.163ns.com @ Linux :~ $

The program prompts you to connect and try again. Just do it.

Www.163ns.com @ Linux :~ $ Ssh-P 3301-I ~ /. Ssh/id_rsa.pub testuser@192.168.56.101Welcome to Ubuntu 12.04 lts (GNU/Linux 3.2.0-23-generic-pae i686)

* Documentation: https://help.Ubuntu.com/

System information as of Thu May 17 00:48:35 CST 2012

System load: 0.01 processes: 73 usage of/: 9.1% of 19.18 GB users logged in: 1 memory usage: 15% IP address for eth0: 192.168.56.101 swap usage: 0%

Graph this data and manage this system at https://landscape.canonical.com/

Last login: Thu May 17 00:45:27 2012 from 192.168.56.1testuser @ demo-server :~ There is a prompt in the middle of $ exit, asking you to enter the previous passphrase password, you only need to enter it once, and then you will no longer need to enter it. OK. Log On again and try again. This time, the Public Key v www.163ns.com @ Linux: ~ is not imported :~ $ SSH testuser@192.168.56.101-P 2201 welcome to Ubuntu 12.04 lts (GNU/Linux 3.2.0-23-generic-pae i686)

* Documentation: https://help.Ubuntu.com/

System information as of Thu May 17 00:49:08 CST 2012

System load: 0.06 processes: 73 usage of/: 9.1% of 19.18 GB users logged in: 1 memory usage: 15% IP address for eth0: 192.168.56.101 swap usage: 0%

Graph this data and manage this system at https://landscape.canonical.com/

Last login: Thu May 17 00:48:52 2012 from 192.168.56.1administrator @ demo-server :~ $ Exitlogoutconnection to 192.168.56.101 closed.www.163ns.com @ Linux :~ $ Log on to the SSH server without entering the password. Check that there are several files in the local. Ssh directory.

Www.163ns.com @ Linux :~ $ Ls. ssh-L total usage 36-rw ------- 1 Jim 1766 May 17 00:46 id_rsa // This is the private key-RW-r -- 1 Jim 396 May 17 00:46 id_rsa.pub // This is the public key-RW- r -- 1 Jim 222 May 17 00:45 known_hosts // This is the public key information of all the SSH servers you have accessed, if this file does not exist, you will be prompted the next time you log on.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.