Pleskでchrooted環境を拡張するには
Plesk / OnixではSSH接続したユーザーが実行できるコマンドは制限されており(Chrooted)、通常bashなどで使えるコマンドが実行できない場合が多いです。これあhシステムをセキュアに保つための措置ですが、何らかの事由によりchroot環境を拡張したい場合もあるでしょう。
そのような場合は以下のコマンドで拡張することができます。
$ wget http://kb.odin.com/Attachments/kcs-19590/chroot_update.zip
# unzip chroot_update.zip
# chmod +x chroot_update.sh
# ./chroot_update.sh --help
最後に実行したのはインストールコマンドのヘルプで、以下のようなマニュアルが表示されるかと思います。
Manage chrooted template in /var/www/vhosts/chroot and apply it to domains.
Usage:
./chroot_update.sh --install
./chroot_update.sh --update
Create default chrooted environment or update existing one
using actual libraries from the system.
./chroot_update.sh --add <path>
Add program to chrooted environment. All linked libraries
will be copied as well. Program will always be put in /bin
directory of chrooted environment.
./chroot_update.sh --devices
Add additional devices to chrooted environment template. List
of devices added includes: /dev/tty, /dev/urandom, /dev/ptmx
and /dev/zero. Useful for some commands like 'rsync', 'ssh' etc.
./chroot_update.sh --remove <domain,...>
./chroot_update.sh --remove all
Remove chrooted environment from specific domains (comma-separated
list) or all domains with enabled chrooted shell if no domains are
given. Useful if full re-initialization of chrooted shell environment
on domain is needed.
./chroot_update.sh --apply <domain,...>
./chroot_update.sh --apply all
Apply new chrooted template to specific domains (comma-separated
list) or all domains with enabled chrooted shell if no domains
are given. This operation is necessary to apply changes done by
'--install', '--add' and '--devices' commands to specific or all
domains.
例えばSSHコマンドを実行したい場合は下記のようにコマンドを入力してインストール可能です。
$ sudo ./chroot_update.sh --devices
$ sudo ./chroot_update.sh --add `which ssh`
$ sudo cp /etc/resolv.conf /var/www/vhosts/chroot/etc/
$ sudo ./chroot_update.sh --apply all