Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sudo ./playback_delete_data_patch.sh 09_delete_old_data_p.sql
- sudo ./playback_delete_data_patch.sh [space] 09_delete_old_data_p.sql
- sudo myscript.sh
- sudo -u username command
- username ALL=(ALL) NOPASSWD: /path/to/script
- #!/bin/bash
- # this declares that current user is a sudoer
- sudo tee /etc/sudoers.d/$USER <<END
- END
- # write the content of your script here
- sudo npm install hexo-cli -g
- mkdir Untitled
- sudo apt-get install python
- # then to remove the sudo access from the current user
- sudo /bin/rm /etc/sudoers.d/$USER
- sudo -k
- #give permissions to the file
- sudo chmod 700 /etc/sudoers.d/useradm
- sudo visudo /etc/sudoers.d/useradm
- #add the following text, changing "user" but your desired user
- user ALL=(ALL)NOPASSWD:ALL
- #return the right permissions to the file
- sudo chmod 440 /etc/sudoers.d/useradm
- expect -c "
- spawn telnet $var
- expect "*Username:*"
- send "$USERNAMEr"
- expect "*Password:*"
- send "$PASSWORDr"
- expect "*#*"
- sleep 5
- send "$CMDr"
- expect "*#*"
- send "endr"
- expect "*#*"
- send "exitr"
- interact
- "
- su - -c "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement