How to give to a user ability like root with visudo?

yael

I add this line to visudo, in order to give full permissions to yael user:

  yael ALL=(ALL) NOPASSWD: ALL

But when I want to update the /etc/hosts file, I get permission denied:

 su – yael
 echo "10.10.10.10 yael_host">>/etc/hosts
 -bash: /etc/hosts: Permission denied


 sudo  echo "10.10.10.10 yael_host">>/etc/hosts
-bash: /etc/hosts: Permission denied


 ls -ltr /etc/hosts
 -rw-r--r--. 1 root root 185 Aug  7 09:29 /etc/hosts

How can I give to user yael ability like root?

Yaron

The source of the problem is that the output redirection is done by the shell (user yael) and not by sudo echo.

In order to enforce that the writing to /etc/hosts will be done by user root instead of user yael - You can use the following format:

echo "10.10.10.10 yael_host" | sudo tee --append /etc/hosts

or

sudo sh -c "echo '10.10.10.10 yael_host'>>/etc/hosts"

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

visudo + read access to file from non root user

分類Dev

How to give non-root user in Docker container access to a volume mounted on the host

分類Dev

How to give role to user for reaction

分類Dev

How to give Solaar root permission on startup

分類Dev

How to NOT become a root user? Are administrators root?

分類Dev

How to give user input in cronjob script

分類Dev

How can I designate the editor for visudo?

分類Dev

visudo:警告:未使用のUser_Alias ADMINS

分類Dev

How to drop privilege of root user initiated process?

分類Dev

Ability to freely transform KineticJS objects like FabricJS

分類Dev

GitHub how to give a user admin access based on repo's tags

分類Dev

How to give user access to specific folder in home directory

分類Dev

how to give permissions to specific user "A" in regedit With regini.exe

分類Dev

How to add an attribute to request like the 'user' variable

分類Dev

Rails 3: How to set the Devise login like root

分類Dev

Fix my Arch system that I've been using root like a normal user on

分類Dev

how to redirect to a subfolder from root, rewrite subfolder link to look like root, and then add some exceptions in htaccess?

分類Dev

How do I start a process with a nice value of -20 and not give it root privilege?

分類Dev

How to give rights for one user(profile) to delete only one other user(profile) in jhipster

分類Dev

How to give reference to static resources like css,images,java script in JSP?

分類Dev

How to autostart a background program by a non-root user?

分類Dev

How to use secret-tool in cronjob with non-root user?

分類Dev

Give user alle permissions of another user

分類Dev

How to update facebook page likes when a new like is made by user?

分類Dev

Access the filesystem as the root user

分類Dev

add a user named root

分類Dev

Can't figure out how to give user all the options for starting, stopping, and restarting program?

分類Dev

How do I give access to a Former users Outlook Calendar to another User

分類Dev

Remove user's ability to disable lockscreen in Gnome 2

Related 関連記事

  1. 1

    visudo + read access to file from non root user

  2. 2

    How to give non-root user in Docker container access to a volume mounted on the host

  3. 3

    How to give role to user for reaction

  4. 4

    How to give Solaar root permission on startup

  5. 5

    How to NOT become a root user? Are administrators root?

  6. 6

    How to give user input in cronjob script

  7. 7

    How can I designate the editor for visudo?

  8. 8

    visudo:警告:未使用のUser_Alias ADMINS

  9. 9

    How to drop privilege of root user initiated process?

  10. 10

    Ability to freely transform KineticJS objects like FabricJS

  11. 11

    GitHub how to give a user admin access based on repo's tags

  12. 12

    How to give user access to specific folder in home directory

  13. 13

    how to give permissions to specific user "A" in regedit With regini.exe

  14. 14

    How to add an attribute to request like the 'user' variable

  15. 15

    Rails 3: How to set the Devise login like root

  16. 16

    Fix my Arch system that I've been using root like a normal user on

  17. 17

    how to redirect to a subfolder from root, rewrite subfolder link to look like root, and then add some exceptions in htaccess?

  18. 18

    How do I start a process with a nice value of -20 and not give it root privilege?

  19. 19

    How to give rights for one user(profile) to delete only one other user(profile) in jhipster

  20. 20

    How to give reference to static resources like css,images,java script in JSP?

  21. 21

    How to autostart a background program by a non-root user?

  22. 22

    How to use secret-tool in cronjob with non-root user?

  23. 23

    Give user alle permissions of another user

  24. 24

    How to update facebook page likes when a new like is made by user?

  25. 25

    Access the filesystem as the root user

  26. 26

    add a user named root

  27. 27

    Can't figure out how to give user all the options for starting, stopping, and restarting program?

  28. 28

    How do I give access to a Former users Outlook Calendar to another User

  29. 29

    Remove user's ability to disable lockscreen in Gnome 2

ホットタグ

アーカイブ