PDA

View Full Version : [ubuntu] to perform admin tasks from script



dinesh17
March 15th, 2012, 04:16 PM
i need to execute the command ifconfig eth0 x.x.x.x from a shell script !! but it needs admin privileges i don't know how to solve this problem please help me !

sudodus
March 15th, 2012, 04:24 PM
Welcome to the Ubuntu Forums!

You get administration privileges by running sudo 'superuser do' and the command.

So in your case

sudo ifconfig eth0 x.x.x.x
Good luck :-)

codemaniac
March 15th, 2012, 04:33 PM
if you want sudo in a script without prompting for password,
edit /etc/sudoers
and add:


username ALL=(ALL) NOPASSWD: ALL

save and that's it.
the username is the user you want to give doing sudo without password.
But as yu can see the above process has security issues .