Reply
Thread Tools
F2thaK's Avatar
Posts: 4,365 | Thanked: 2,467 times | Joined on Jan 2010 @ Australia Mate
#1
How do I Run a script with root privelages?

Im going to try:

to execute: (in xterm)

devel-su
[root pw]
sh ssh_root.sh

ssh_root.sh script:
Code:
#!/bin/sh#
devel-su
rm  /etc/ssh/sshd_config
mv /home/user/MyDocs/sshd_config /etc/ssh/sshd_config
echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh
pkill -9 /usr/sbin/sshd
would this work????
 
StefanL's Avatar
Posts: 298 | Thanked: 341 times | Joined on Aug 2010 @ This world :)
#2
I use sudo sh script.sh.
__________________
My phone evolution: Nokia 7610 (RIP), N82 (RIP), BB9000 (RIP), N900, BB9760 (RIP), N8, BB9900, N9 64GB
Working : Python Gorillas (Maemo5) Faircrack0.50 Update (Maemo5)
Not so much : WPScrack (Maemo5)
 
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#3
Originally Posted by F2thaK View Post
How do I Run a script with root privelages?

Im going to try:

to execute: (in xterm)

devel-su
[root pw]
sh ssh_root.sh

ssh_root.sh script:
Code:
#!/bin/sh# <-- remove the #
devel-su
rm  /etc/ssh/sshd_config
# mv /home/user/MyDocs/sshd_config /etc/ssh/sshd_config
# better
cp -r /home/user/MyDocs/sshd_config /etc/ssh/
echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh
pkill -9 /usr/sbin/sshd
would this work????
run-standalone.sh scriptname.sh

Last edited by santiago; 2011-12-01 at 12:58.
 

The Following User Says Thank You to santiago For This Useful Post:
F2thaK's Avatar
Posts: 4,365 | Thanked: 2,467 times | Joined on Jan 2010 @ Australia Mate
#4
Originally Posted by santiago View Post
run-standalone.sh scriptname.sh
thanks, but I dont get the
Code:
run-standalone.sh scriptname.sh
part...
 
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#5
Originally Posted by F2thaK View Post
thanks, but I dont get the
Code:
run-standalone.sh scriptname.sh
part...
xterminal
 
F2thaK's Avatar
Posts: 4,365 | Thanked: 2,467 times | Joined on Jan 2010 @ Australia Mate
#6
yeh I know xterm, but I do "sh ssh_root.sh" and it seems to work
 
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#7
Originally Posted by F2thaK View Post
yeh I know xterm, but I do "sh ssh_root.sh" and it seems to work
fine then you better bro'
 
F2thaK's Avatar
Posts: 4,365 | Thanked: 2,467 times | Joined on Jan 2010 @ Australia Mate
#8
I said it *seems* to work, just wanted to know if its right
 
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#9
Originally Posted by F2thaK View Post
I said it *seems* to work, just wanted to know if its right
open xterm, run the script and post the result here
 
Posts: 35 | Thanked: 4 times | Joined on Nov 2011 @ hungaryan
#10
pleas help me!!I write devel-su,password:rootme ok.But when I write /etc/ssh/sshd_config than permission denied!!Why???
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:53.