Skip to main content
Post Undeleted by Dentrasi
added 243 characters in body
Source Link
Dentrasi
  • 3.8k
  • 1
  • 26
  • 19

Use chmod +s <filename>Use chmod +s <filename> to se the suid bit. This means that when the file is executed, it runs with the permissions of the owner of the file (so chown it to root to make it run as that).

However, this can be VERY dangerous with something like a bash scripts, because a user finds a way to change it, they can easily gain a root shell. Make sure that it can't be written to by anyone except root.

Linux doesn't allow you to se the suid bit. This means that when the file is executedsetuid on scripts, it runs with the permissions of the owner of the file (so chown it to rootdo this you'd have to makecompile it run as that)a program.

However Instead, thisyou can be VERY dangerous with something like a bash scripts, because a user finds a way to change ituse the sudoers file (/etc/sudoers), they can easily gainand add a root shell. Make sure that it can't be written to by anyone except rootline like this.

<username> ALL = NOPASSWD: /path/to/script

Use chmod +s <filename> to se the suid bit. This means that when the file is executed, it runs with the permissions of the owner of the file (so chown it to root to make it run as that).

However, this can be VERY dangerous with something like a bash scripts, because a user finds a way to change it, they can easily gain a root shell. Make sure that it can't be written to by anyone except root.

Use chmod +s <filename> to se the suid bit. This means that when the file is executed, it runs with the permissions of the owner of the file (so chown it to root to make it run as that).

However, this can be VERY dangerous with something like a bash scripts, because a user finds a way to change it, they can easily gain a root shell. Make sure that it can't be written to by anyone except root.

Linux doesn't allow you to setuid on scripts, to do this you'd have to compile it as a program. Instead, you can use the sudoers file (/etc/sudoers), and add a line like this.

<username> ALL = NOPASSWD: /path/to/script

Post Deleted by Dentrasi
Source Link
Dentrasi
  • 3.8k
  • 1
  • 26
  • 19

Use chmod +s <filename> to se the suid bit. This means that when the file is executed, it runs with the permissions of the owner of the file (so chown it to root to make it run as that).

However, this can be VERY dangerous with something like a bash scripts, because a user finds a way to change it, they can easily gain a root shell. Make sure that it can't be written to by anyone except root.