Skip to content

Instantly share code, notes, and snippets.

@lapis-zero09
Last active March 3, 2016 10:45
Show Gist options
  • Save lapis-zero09/0d71fea8718c3ef18836 to your computer and use it in GitHub Desktop.
Save lapis-zero09/0d71fea8718c3ef18836 to your computer and use it in GitHub Desktop.
Host sakura
  HostName {さくらのIPアドレス}
  User {useraddしたユーザの名前}
  Port {/etc/ssh/ssh_config.orgのPortで指定した番号}
  IdentityFile ~/.ssh/id_rsa.sakura
$ ssh root@{サーバのIPアドレス}
$ yum update
$ ssh-keygen -t rsa
Enter file in which to save the key : id_rsa.sakura
Enter passphrase :
$ ls -a ~/.ssh
id_rsa.sakura id_rsa.sakura.pub
$ chmod 600 id_rsa.sakura.pub
$ cd ~/.ssh
$ vim config
$ ssh sakura
$ scp ~/.ssh/id_rsa.sakura.pub sakura:~/.ssh/authorized_keys
$ ls -a ~/.ssh
authorized_keys
$ vim ~/.ssh/config
$ yum clean up
$ yum update
$ cp /etc/ssh/ssh_config /etc/ssh/ssh_config.org
$ vim /etc/ssh/ssh_config
$ service sshd restart
$ vim ~/.ssh/config
$ vim /etc/sysconfig/iptables
$ service iptables start
$ vim /etc/sysconfig/i18n
$ iptables -L
$ useradd {新しいユーザの名前}
$ passwd {useraddしたユーザの名前}
$ usermod -G wheel {useraddしたユーザの名前}
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
LANG="ja_JP.UTF-8"
SYSFONT="latarcyrheb-sun16"
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:SERVICES - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit 1/s --limit-burst4 -j ACCEPT
-A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -j SERVICES
-A INPUT -p udp --sport 53 -j ACCEPT
-A INPUT -p udp --sport 123 --dport 123 -j ACCEPT
-A SERVICES -p tcp --dport {/etc/ssh/ssh_config.orgのPortで指定した番号} -j ACCEPT
-A SERVICES -p tcp --dport 80 -j ACCEPT
-A SERVICES -p tcp --dport 443 -j ACCEPT
COMMIT
#Port 22
Port {任意の番号}
PasswordAuthentication yes
PasswordAuthentication no
#PermitRootLogin yes
PermitRootLogin no
# %wheel ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment