You are not logged in.

#1 2011-11-30 11:02:21

martinnj
Member
Registered: 2011-05-28
Posts: 28

Bash error: Standard in must be a tty

Hey,

i recieve the above message every time i try tu run this script:

#!/bin/bash
# Should be placed in the /etc/wicd/scripts subfolder for connect.

ESSID=`iwconfig wlan0 |grep "ESSID"|sed -e 's/.*ESSID:"\(.*\)"/\1/'`

STRING='myESSIDwidget.text="  Connected to:<span color=\"green\"> '$ESSID'</span>  | "'

echo -e $STRING | su martin awesome-client

The first line graps the connected ESSID using regular expressions.
The second is creating a string that will be executed in awesome later.
The last line pipelines the string into awesome-client using my personal user (if root does it, i get some weird d-bus error)

Can anyone help with this ? :-)

//Martin

Offline

#2 2011-11-30 16:45:38

Damnshock
Member
From: Barcelona
Registered: 2006-09-13
Posts: 414

Re: Bash error: Standard in must be a tty

"su" is expecting you to input the password for the user "martin" and it's telling you that you need it to be a tty (otherwise you could not enter the password wink )

Have a look at sudo


My blog: blog.marcdeop.com
Jabber ID: damnshock@jabber.org

Offline

#3 2011-12-02 12:38:33

martinnj
Member
Registered: 2011-05-28
Posts: 28

Re: Bash error: Standard in must be a tty

Well that explains a lot...
Is there a way to supply it beforehand? Or have the command run from that user?

The problem lies in that if any other user than martin runs it, awesome-client will give some d-bus error about
the session being unable to connect.

Offline

#4 2011-12-12 16:41:31

n0stradamus
Member
Registered: 2010-11-08
Posts: 94
Website

Re: Bash error: Standard in must be a tty

martinnj wrote:

Well that explains a lot...
Is there a way to supply it beforehand? Or have the command run from that user?

The problem lies in that if any other user than martin runs it, awesome-client will give some d-bus error about
the session being unable to connect.

As Damnshock already said: Have a look at sudo. You can configure the rights on a per-user basis, so that e.g. 'martin' would be able to execute the 'awesome-client' without having to enter a password.
A cause for the error when trying to run as a different user might be dbus. Do you have the dbus in your rc.conf DAEMONS Array and following line in your .xinitrc?

exec ck-launch-session [your environment here]

The wicd wiki entry also has a section on this problem: clickme

Last edited by n0stradamus (2011-12-12 16:42:11)

Offline

Board footer

Powered by FluxBB