4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SubsystemとForceCommand

Last updated at Posted at 2014-06-30

sshは接続側で色々できるが、ssh-server側でも色々できる。

参考

sshd_configの最終行に記述。

/etc/ssh/sshd_config
...
UsePAM yes

Subsystem sftp internal-sftp
Subsystem yo /bin/echo yo
Subsystem man /usr/bin/man sftp-server

Match Group sftponly
  ForceCommand /bin/echo yo

syntax checkはsshd -tでできます。

# sshd -t
# initctl restart ssh

Subsystemを利用してみる

  • ssh 192.168.100.3 -s サブシステム指定

という書式。

$ ssh 192.168.100.3 -s yo
yo
$ ssh 192.168.100.3 -s man
man sftp-serverが実行され接続が終了する。
$ ssh 192.168.100.3 -s sftp
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?