http://www.haogongju.net/art/2031109 編譯hadoop eclipse plugin
設置root密碼:
sudo passwd
輸入登錄密碼,
設置root密碼.
重複root密碼
su
登錄root.
Ubuntu自身默認是不帶OpenSSH Server,而是隻有OpenSSH Client。OpenSSH Server的安裝方法:
sudo apt-get install openssh-server
安裝完這個openssh-server後就可以用ssh連接到ubuntu上了.
root@hostname:~# sudo ufw disable
防火牆在系統啓動時自動禁用
當ubuntu防火牆開啓時你可以Ping通, 但是無法ssh登錄.
root@hadoop-slave2:/home# ufw enable 開戶防火牆
Firewall is active and enabled on system startup
root@hadoop-slave2:/home# ufw status 查看防火牆狀態
Status: active
root@hadoop-slave2:/home# ufw disable 禁用防火牆
Firewall stopped and disabled on system startup
root@hadoop-slave2:/home# ufw status
Status: inactive
我將原先的ubuntu系統clone了一份.
現在想改變其用戶名登錄名主目錄
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 到這我還不能直接用當前用戶來改變其主目錄 .
有說在recovery模式去改變.
http://hi.baidu.com/iopcajofaabcsud/item/b491c333ef47bbf62684f429
我創建了新的用戶slave3
sudo adduser slave3 #注意是adduser而不是useradd
sudo passwd myUserName # 設置初始密碼
然後刪除slave2用戶.
以下用newuser代替想要刪除的用戶賬戶
在root用戶下:userdel -r newuser
在普通用戶下:sudo userdel -r newuser
網上還有配置ssh服務器, 先記下來
轉載:http://www.163ns.com/zixun/post/5213.html
Ubuntu下如何配置SSH服務器
環境
os:Ubuntu 12.04
1.安裝
服務器端:
sudo apt-get install ssh openssh-server ssh-import-id
客戶端:
www.163ns.com @linux:~$sudo apt-get install openssh-client
2.配置
2.1.修改ssh端口
默認的ssh端口是22,太扎眼,建議改成別的端口,比如3301。
修改 /etc/ssh/sshd_config文件
將其中的
# port 22
改成
port 3301
改完要重啓ssh服務
www.163ns.com @linux:~$ sudo /etc/init.d/ssh restart
3.登錄
一般的登錄ssh服務器的方式有兩種,一種是使用密碼,還有一種是使用密鑰文件登錄。
3.1.使用密碼登錄
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.18GB 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
看到類似這些信息就說明登錄成功了。
這種方式比較簡單,但安全性稍差。
3.2.公鑰-私鑰登錄
首先在終端執行
www.163ns.com @linux:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jim/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): //這裏需要輸入你的passphrase密碼,這個密碼一會還要用到
Enter same passphrase again:
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 @linux
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . |
| S |
| + .. . . |
| ...+. . .= +|
| .oo..o .+.oE|
| o. .o.. .+o=|
+-----------------+
www.163ns.com @linux:~$
上傳公鑰
Warning: Identity file ~/.ssh/id_rsa.pub not accessible: No such file or directory.
Now try logging into the machine, with "ssh '-p 3301 -i ~/.ssh/id_rsa.pub [email protected]'", and check in:
~/.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
www.163ns.com @linux:~$
程序提示你連接一下試試,照做吧
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:48:35 CST 2012
System load: 0.01 Processes: 73
Usage of /: 9.1% of 19.18GB 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.1
testuser@demo-server:~$ exit
中間有個提示,讓你輸入先前的passphrase密碼,只需要輸入一次,以後就再也不用輸入了。
ok,再登錄一下試試,這次不導入公鑰了v
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.18GB 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.1
administrator@demo-server:~$ exit
logout
Connection to 192.168.56.101 closed.
www.163ns.com @linux:~$
沒有輸入密碼直接就登入到ssh服務器了。
看一下本地的.ssh目錄有這麼幾個文件
www.163ns.com @linux:~$ ls .ssh -l
總用量 36
-rw------- 1 jim jim 1766 5月 17 00:46 id_rsa //這是私鑰
-rw-r--r-- 1 jim jim 396 5月 17 00:46 id_rsa.pub //這是公鑰
-rw-r--r-- 1 jim jim 222 5月 17 00:45 known_hosts //這是你所有訪問過的ssh服務器的公鑰信息,如果這個文件沒有的話,下次登錄時會提示你。