Archive for the ‘ssh’ Category

 

ssh接続切断等で screen 復帰方法 を一行で。

11月 21st, 2013

$ screen -ls There is a screen on: 56426.pts-0.vps60 (Attached) 1 Socket in /var/run/screen/S-xxxxx. $ screen -D 56426 [56426.pts-0.vps60 power detached.] $ screen -r screenを終了せずに、接続切断してしまった場合等、screen -r で復帰出来ないので 一度残っているscreenをログアウトします。power detachedで。 その後、screen -rで復帰します。 を一行で。 $ screen -ls|awk ‘{if( $0~/pts/ ){gsub(“.pts.*”,””,$0);gsub(“[\t ]+”,””,$0);print $0;}}’|xargs screen -D |screen -r

Read full article | コメントは受け付けていません。

screen maxwin ウィンドウ数を制限する。

8月 22nd, 2013

maxwinのデフォルトは40らしい。 開発環境のopenvzが8接続しか出来ないので、screenでたくさん開いて切れるとつなげなくなるので、止めておく。 screen ctrl+a :maxnum 5 で、5個以上windowを生成出来なくなる == /etc/security/limits.conf maxloginsも設定しておく @users – maxlogins 7 usersは 7までしかログイン出来なくしておく。 screen の maxnumをしてなくてもこの上限となる。

Read full article | コメントは受け付けていません。

sftp: sshでログインさせず、特定ディレクトリのみ利用させる

7月 19th, 2013

/etc/ssh/sshd_conf Subsystem       sftp    internal-sftp Match AllowGroups sftpuser        ChrootDirectory /home/sftpuser/%u/data        X11Forwarding no        AllowTcpForwarding no        PasswordAuthentication yes        ForceCommand internal-sftp とりあえず sftpuserグループの人は、それぞれのディレクトリ のsftpdataに書き込めるように設定する必要がある。

Read full article | コメントは受け付けていません。

さくらの専用サーバー : iptables 設定。

3月 28th, 2010

まずは、設定をミスっても(無料)再起動で対応可能にしておく。 # /sbin/chkconfig iptables –list iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off # /sbin/chkconfig iptables off # /sbin/chkconfig iptables –list iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off 接続不能になったら再起動してもらいましょう。 設定完了確認後 on にしておきましょう。 または、起動後は自分でiptablesを実行することをお忘れなく。 まずは、つながらなくなると困るので ポリシー設定 INPUT ACCEPT /sbin/iptables -P INPUT ACCEPT /sbin/iptables -P OUTPUT ACCEPT /sbin/iptables -P FORWARD DROP 確認 /sbin/iptables -L ルールを消す。 /sbin/iptables […]

Read full article | コメントは受け付けていません。

ssh connectしてみる。

11月 4th, 2009

# mkdir .ssh # ssh-keygen id_rsa id_rsa.pub が生成されます。 接続先に id_rsa.pubの内容を authorized_keysへ書き込む。 = permission 755 ~ 755 .ssh 600 id_rsa 644 authorized_keys で良いですかな? * パーミッションがおかしいとつながりません。 * あとは、/etc/ssh_config sshd_configの設定を。

Read full article | コメントは受け付けていません。