The sed command does inline updates to the /etc/sudoers file to allow foo and root users passwordless access to the sudo group.The home directory is set to /home/foo.The uid and gid is set to the value of 999.The user foo is added to the both the foo and sudo group.Sed -i /etc/sudoers -re 's/^#includedir.*/# **Removed the include directive** #"/g' & \Įcho "foo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers & \Įcho "Customized the sudoers file for passwordless access to the foo user!" & \ Sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' & \ ![]() Sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' & \ Groupadd -g 999 foo & useradd -u 999 -g foo -G sudo -m -s /bin/bash foo & \ Instead, create a script that does what you want (looks up current directory, determines its owner and group, creates a directory Doing it this way means that the user only has to navigate to the directory then sudo create-Here's how I setup a non-root user with the base image of ubuntu:18.04: RUN \ It seems you want to let users create sub-directories with a specific name owned by the owner of the parent directory. I won't get into that as it's out of scope but, to accomplish what you want and more flexibility, there may be a better way. Parts of your description imply that you have things setup in a bizarre way. Really this isn't the way to do something like this. Since this rule matches the situation, but requires a password, a password was being asked.) I had a problem in my own config where I was specifying %sudo ALL=(ALL:ALL) ALL afterwards. ![]() If you have another rule after this one that would cover the same command (such as ALL) it would take effect instead. This reads something like: "Allow any user on any domain to act as any user:group without asking for a password to execute the exact command "mkdir (Rules are determined in order with the last matching rule taking effect. ![]() Create a rule as such: ALL ALL=(ALL:ALL) NOPASSWD: /bin/mkdir www ""
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |