Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. sudo ./playback_delete_data_patch.sh 09_delete_old_data_p.sql
  2.  
  3. sudo ./playback_delete_data_patch.sh [space] 09_delete_old_data_p.sql
  4.  
  5. sudo myscript.sh
  6.  
  7. sudo -u username command
  8.  
  9. username ALL=(ALL) NOPASSWD: /path/to/script
  10.  
  11. #!/bin/bash
  12. # this declares that current user is a sudoer
  13. sudo tee /etc/sudoers.d/$USER <<END
  14. END
  15.  
  16. # write the content of your script here
  17. sudo npm install hexo-cli -g
  18. mkdir Untitled
  19. sudo apt-get install python
  20.  
  21. # then to remove the sudo access from the current user
  22. sudo /bin/rm /etc/sudoers.d/$USER
  23. sudo -k
  24.  
  25. #give permissions to the file
  26. sudo chmod 700 /etc/sudoers.d/useradm
  27.  
  28. sudo visudo /etc/sudoers.d/useradm
  29.  
  30. #add the following text, changing "user" but your desired user
  31. user ALL=(ALL)NOPASSWD:ALL
  32.  
  33. #return the right permissions to the file
  34. sudo chmod 440 /etc/sudoers.d/useradm
  35.  
  36. expect -c "
  37. spawn telnet $var
  38. expect "*Username:*"
  39. send "$USERNAMEr"
  40. expect "*Password:*"
  41. send "$PASSWORDr"
  42. expect "*#*"
  43. sleep 5
  44. send "$CMDr"
  45. expect "*#*"
  46. send "endr"
  47. expect "*#*"
  48. send "exitr"
  49. interact
  50. "
  51.  
  52. su - -c "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement