Steam for Linux

Steam for Linux

hashworks 30 jun. 2014 às 14:07
[SOLVED] Start BASH script with sudo commands from steam
I'm currently trying to reboot my ubuntu system to windows using a steam shortcut.
I added the following script to my steam library:

#!/bin/bash sudo grub-reboot "Windows" >> test 2>&1 sudo reboot >> test 2>&1

I also added grub-reboot and reboot to sudoers:
hashworks ALL = (root) NOPASSWD: /usr/sbin/grub-reboot hashworks ALL = (root) NOPASSWD: /usr/sbin/reboot

Manually the script works just fine, also steam executes it as 'hashworks'.
However, the output of the file "test" is the following:
Sudo: no tty present and no askpass program specificed

Any idea?
Última alteração por hashworks; 1 jul. 2014 às 9:38
< >
A mostrar 1-4 de 4 comentários
Angry Mongoose 30 jun. 2014 às 14:58 
oh i don't know... maybe you need to input the password for sudo to work?
slrp 30 jun. 2014 às 15:45 
You might try making your script launch a new terminal window with the commands you want so that you're able to enter your password.
I don't think it would be wise to set it up so that you don't have to enter your password, it would be a huge security risk.

However, to allow yourself to enter a password you could try something like this
(this is for a rxvt-unicode terminal, if you use something else you'll have to modify it)
#!/bin/bash urxvt -e sudo grub-reboot "Windows" >> test 2>&1 && sudo reboot >> test 2>&1

that will start a terminal window and pass in the 2 commands to that new session to be run, which will allow you to enter your password.

If you need help modifying the command please tell us which terminal emulator you use
Última alteração por slrp; 30 jun. 2014 às 20:05
hashworks 30 jun. 2014 às 22:35 
Originalmente postado por Angry Mongoose:
oh i don't know... maybe you need to input the password for sudo to work?

Thats why I used the sudoers file. I need to reboot the pc to windows using Steam Streaming from somewhere in the house.

Originalmente postado por mearo (´・ω・`):
You might try making your script launch a new terminal window with the commands you want so that you're able to enter your password.
I don't think it would be wise to set it up so that you don't have to enter your password, it would be a huge security risk.

I'm ok with limiting the risk to reboot and grub-reboot, everything else needs a pw of course. I'm absolutly unable to enter a password from the couch with a xbox360 controller in my hands.

Originalmente postado por Angry Mongoose:
However, to allow yourself to enter a password you could try something like this
(this is for a rxvt-unicode terminal, if you use something else you'll have to modify it)
#!/bin/bash urxvt -e sudo grub-reboot "Windows" >> test 2>&1 && sudo reboot >> test 2>&1

Mhm, I already had that idea with gnome-terminal,
which didn't work because of other stuff.

However, trying urxvt only grub-reboot worked - reboot requested a password.
Looking at /etc/sudoers showed me that the path in there was wrong (it's /sbin/reboot and not /usr/sbin/reboot). At the moment I tryed the script manually I already entered the sudo pw once leaving the sudoers file untestet (♥♥♥♥♥♥♥♥♥♥, yesterday-me...)

So I changed the path and now everything is working fine, without urxvt. Thanks for the help mearo!
Última alteração por hashworks; 30 jun. 2014 às 22:38
slrp 1 jul. 2014 às 0:22 
glad you got it working
< >
A mostrar 1-4 de 4 comentários
Por página: 1530 50

Postado a: 30 jun. 2014 às 14:07
Comentários: 4