ECS Ubuntu版本
購買完成後,進入實例列表。如果之前沒有設置密碼,則在實例列表中可以進行相關操作。
- 重置密碼
點擊更多->重置密碼
,重置密碼後,記得重啓該實例。
- ssh登錄
$ sudo ssh IP地址
Password: // 輸入本機密碼
The authenticity of host 'IP地址' can't be established.
RSA key fingerprint is [RSA key].
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'IP地址' (RSA) to the list of known hosts.
root@IP地址's password: // 輸入ECS設置密碼
Welcome to aliyun Elastic Compute Service!
Last login: Thu Jul 20 20:35:35 2017
- 添加用戶
在實際操作過程中,應避免使用root權限。
// 創建用戶組
root@xxxx:~# addgroup xxx
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Adding group `xxx' (GID 1004) ...
Done.
// 創建新用戶yyy
root@xxxx:~# adduser yyy // 添加新用戶yyy
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "zh_CN.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `yyy' ...
Adding new group `yyy' (1002) ...
Adding new user `yyy' (1002) with group `yyy' ...
Creating home directory `/home/yyy' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: // 設置新用戶密碼
Retype new UNIX password: // 設置新用戶密碼
passwd: password updated successfully
Changing the user information for yyy
Enter the new value, or press ENTER for the default
Full Name []: yyy // 新用戶信息
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
// 添加完成後,使用以下命令查看
$ ls /home
yyy // 新用戶目錄
// 用戶添加到組
root@xxxx:~# gpasswd -a yyy xxx
Adding user yyy to group xxx
// 查看所有用戶組
root@xxxx:~# cat /etc/group
- 安裝軟件
// 更新apt-get
$ apt-get update
// 安裝git
$ apt-get install git
// 查看git版本
$ git --version
- 退出
$ exit
參考
內容來源:https://blog.csdn.net/zdwzzu2006/article/details/7944434
1、/etc/group 解說;
/etc/group
文件是用戶組的配置文件,內容包括用戶和用戶組,並且能顯示出用戶是歸屬哪個用戶組或哪幾個用戶組,因爲一個用戶可以歸屬一個或多個不同的用戶組;同一用
戶組的用戶之間具有相似的特徵。比如我們把某一用戶加入到root用戶組,那麼這個用戶就可以瀏覽root用戶家目錄的文件,如果root用戶把某個文件
的讀寫執行權限開放,root用戶組的所有用戶都可以修改此文件,如果是可執行的文件(比如腳本),root用戶組的用戶也是可以執行的;
用戶組的特性在系統管理中爲系統管理員提供了極大的方便,但安全性也是值得關注的,如某個用戶下有對系統管理有最重要的內容,最好讓用戶擁有獨立的用戶組,或者是把用戶下的文件的權限設置爲完全私有;另外root用戶組一般不要輕易把普通用戶加入進去,
2、/etc/group 內容具體分析
/etc/group 的內容包括用戶組(Group)、用戶組口令、GID及該用戶組所包含的用戶(User),每個用戶組一條記錄;格式如下:
group_name:passwd:GID:user_list
在/etc/group 中的每條記錄分四個字段:
第一字段:用戶組名稱;
第二字段:用戶組密碼;
第三字段:GID
第四字段:用戶列表,每個用戶之間用,號分割;本字段可以爲空;如果字段爲空表示用戶組爲GID的用戶名。