Add read-only users in linux

Source: Internet
Author: User

USER = onlyread

02 chattr-I/etc/passwd/etc/shadow/etc/group

03 ln-s/bin/bash/bin/rbash

04 echo/bin/rbash>/etc/shells

05 useradd-c "A Restricted User"-s/bin/rbash $ USER

06 rm-rf/home/$ USER /\.*

07 echo "export PATH =/home/$ USER/bin">/home/$ USER/. bashrc

08 for I in. bash_login. bash_profile. bash_logout. profile. bashrc; do echo ".. bashrc">/home/$ USER/$ I; done

09 mkdir/home/$ USER/bin/

10 CMD = "cat awk sed ping" // set the command to be sent to the user

11 for I in $ CMD; do ln-sf $ (which $ I | grep-v alias | sed's/\ t * // G ') /home/$ USER/bin/$ I; done

12 chmod 750/home/$ USER-R

13 chmod 444/home/$ USER/. bash */home/$ USER/. profile

14 chown root: $ USER/home/$ USER/. bash */home/$ USER-R

15 echo 111111 | passwd -- stdin $ USER



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.