Created
February 7, 2013 03:07
-
-
Save satoshin2071/4728078 to your computer and use it in GitHub Desktop.
公開鍵認証作業ログ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
■Group基本設定 | |
# /usr/sbin/groupadd -g 1001 soko | |
# /usr/sbin/groupadd -g 1101 doko | |
# /usr/sbin/groupadd -g 8001 asoko | |
# /usr/sbin/groupadd -g 10001 koko | |
# | |
■user追加 | |
[root@servername ~]# /usr/sbin/useradd -g 1001 -G doko,asoko -u 1087 ssato | |
■sudoを使えるようにする | |
・sudoがinstallされているか確認 | |
[root@servername ~]# yum list installed |grep sudo | |
sudo.i386 1.7.2p1-9.el5_5 installed | |
・visudo(/usr/sbin/visudo)を使い、sudo できるユーザ(グループ)を /etc/sudoersに記述 | |
[root@servername ~]# visudo | |
# %wheel ALL=(ALL) ALL | |
の下に | |
%soko ALL=(ALL) ALL | |
rootのまま各ユーザにsu して cd | |
ssh-kegen | |
で公開鍵と秘密鍵作成されるので | |
cd .ssh/ | |
で公開鍵を authorized_keys の最後に追加 | |
$ cat id_rsa.pub >> authorized_keys | |
これを使いたいユーザ分。 | |
で生成されたid_rsaをコピペでローカルid_rsaを作成する。 | |
■複数あると面倒のでid_rsa.hogeみたいな感じで秘密鍵の名前を変えて管理する | |
macなら | |
Mac-mini%vim /Users/username/.ssh/config | |
Host hoge | |
HostName xx.xxx.xxx.xxx | |
Port xxxxx | |
User username | |
IdentityFile /Users/username/.ssh/id_rsa.hoge | |
Host locahan | |
HostName xx.xxx.xxx.xxx | |
Port xxxxx | |
User username | |
IdentityFile /Users/username/.ssh/id_rsa.huga | |
みたいな感じで設定 | |
で ssh hoge ってやると公開鍵で入れる | |
設定的には | |
sudo vi /etc/ssh/sshd_config | |
Port xxxxxx | |
PermitRootLogin no #rootログイン禁止 | |
PasswordAuthentication no #パスワード認証禁止 | |
PermitEmptyPasswords no #空パス禁止 | |
とかやっとく。 | |
サーバー側でsshd-configとか設定してるとはじかれる。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment