个人工具

UbuntuHelp:UbuntuLTSP/UnlockChrootRootAcct

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 8.04, 8.10, 9.04, 9.10 and 10.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


NOTE: Please use this page as a reference for other pages instead of simply copying the code.


This page is dedicated to unlocking the 'root' user account in the LTSP client chroot environment. There are many reasons to do this, which are most likely linked directly to this article (which is possibly how you got to this page in the first place!). Bear in mind however, that unlocking a user account does not have the same meaning as in certain other Operating Systems, as the only thing you really unlock is the password, as per usermod(1), and hence the ability to authenticate and log in by means of it. One still can e.g. log in through SSH using a certificate key, or run cron jobs as this acount. Before proceding, be sure you really need to do this. By default in Ubuntu (server and chroot filesystems), the 'root' account is locked and users are advised to use 'sudo' to perform administrative tasks. This is a good idea, but there are also good reasons to use the root account directly. To create an administrative user account in the chroot that can sudo to root, see create|an admin account in the chroot.

  • The procedure is fairly simple. Here we use a 32-bit (i386) client for the example. Changes for 64-bit client images should be obvious. First step is to unlock the account inside the chroot:
sudo chroot /opt/ltsp/i386 passwd -u root
  • Second step (optional) is to provide a password for root. Make sure this is a robust password:
sudo chroot /opt/ltsp/i386 passwd
  • Lastly, update the client image to reflect the changes we just made:
sudo ltsp-update-image

All done!


How to re-lock the root account After original reason for unlocking the LTSP client chroot environment root account is gone it is recommended to re-lock this root account.

  • This are the commands to reverse the previous unlocking:
sudo chroot /opt/ltsp/i386 passwd -l root
sudo ltsp-update-image