LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Incognito
User Name
Password
Incognito This forum is for the discussion of Incognito Linux.

Notices


Reply
  Search this Thread
Old 06-27-2009, 12:29 PM   #1
Sylvester
LQ Newbie
 
Registered: Jun 2009
Posts: 27

Rep: Reputation: 15
Automating detection of Internet USB dongle via udev


I have been following a how-to that explains the normal method of doing this:

http://crazyaboutubuntu.wordpress.co...ick-on-ubuntu/

The normal method is to add a udev rule (/etc/udev/rules.d/) that executes some script the moment udev detects that the dongle has been plugged in.

The problem is that /etc/ is not persistent in incognito.

I am attempting to solve it by executing a script that will write the rule file /etc/udev/rules.d/bla.rules upon start-up

But now I encounter a further problem: how to get a script to execute upon start-up? it seems (from playing around on the command line) that only root can execute a #!/bin/sh script. This seems to rule out placing it in /home/incognito/.kde/Autostart/ - although I am not 100% sure, I have a feeling anything in this folder gets executed as user:incognito rather than user:root

I am a bit stuck. Should I be trying to make /etc persistent? there is probably a good reason it was made non-persistent in the first place, yes?

Sy
 
Old 06-27-2009, 02:51 PM   #2
Sylvester
LQ Newbie
 
Registered: Jun 2009
Posts: 27

Original Poster
Rep: Reputation: 15
Could someone please have a go and see if you can get a trivial bash script to execute on start-up?

I have to give up - I have exhausted the freenode channels and nobody seems to have any idea.

The nub of the problem seems to be I cannot execute a bash script if I am not root. it will generate the error /bin/bash: bad interpreter: permission denied.

Oddly enough
/bin/bash -c 'echo foo'
Behaves correctly

And of course executing the script as root works.

I have checked the permissions on bash and sh, and these are all good - they are executable by everyone.

I have checked the permissions on my script, and made sure the owner is root.

Still no luck.

Does it matter what group the script belongs to? I don't really understand groups, and for now I'm exhausted - my hands hurt a lot when I type. so I have to go slow...

Sy
 
Old 06-27-2009, 07:32 PM   #3
anonym
Incognito Maintainer
 
Registered: Oct 2008
Distribution: Gentoo
Posts: 100

Rep: Reputation: 26
Quote:
Originally Posted by Sylvester View Post
The nub of the problem seems to be I cannot execute a bash script if I am not root. it will generate the error /bin/bash: bad interpreter: permission denied.
As I said on irc, this is due to GrSec's Trusted Path Execution (TPE). What I said to you was wrong, though. It's the directory the executable file is located in, not the executable itself, that must be owned by root, and additionally none other than root should have write permission to it. You can fix this with:
Code:
chown root ~/.kde/Austostart
chmod go-w  ~/.kde/Austostart
Quote:
Originally Posted by Sylvester View Post
Oddly enough
/bin/bash -c 'echo foo'
Behaves correctly
This isn't strange -- you can run 'echo foo' in a bash shell as the incognito user, right? What I think you meant was that running '/bin/bash ./kde/Austostart/foo.sh' works is weird, but really it's not; in this case what we really execute is /bin/bash (/bin is owned by root and have the nice permissions so TPE won't interfere), but the commands in foo.sh are passed to the bash interpreter. foo.sh isn't executed directly (i.e. running ~/.kde/Austostart/foo.sh) which is the only thing TPE cares about.

Quote:
Originally Posted by Sylvester View Post
Does it matter what group the script belongs to?
Not with the standard permissions.

Last edited by anonym; 06-27-2009 at 07:34 PM.
 
Old 06-28-2009, 06:55 AM   #4
Sylvester
LQ Newbie
 
Registered: Jun 2009
Posts: 27

Original Poster
Rep: Reputation: 15
Thank you for the post!

Unfortunately I have fallen at the very next hurdle - now I can execute the script, however the sole purpose of the script is to create two symbolic links into /etc/ and /etc/udev/rules.d/, and these cannot be done as non-root.

I have tried putting 'su -' near the beginning of the script. If I simply execute the script from the command line as non-root, it works. But if I allow the script to execute automatically upon start-up, it does not work - I checked these folders on the link has not been created.

Much as I would love to fiddle for days and write up a how-to once I get it all figured, I'm going to have to let go, as my hands cannot cope with the typing. I am still curious as to any possible solutions, and if anonym keeps up this incredible level of technical support I will endeavour to get there.

Sy
 
Old 06-28-2009, 07:24 AM   #5
anonym
Incognito Maintainer
 
Registered: Oct 2008
Distribution: Gentoo
Posts: 100

Rep: Reputation: 26
Quote:
Originally Posted by Sylvester View Post
I have tried putting 'su -' near the beginning of the script. If I simply execute the script from the command line as non-root, it works. But if I allow the script to execute automatically upon start-up, it does not work - I checked these folders on the link has not been created.
'su -' will open a new root shell but the commands listed after won't be executed in the root shell. They will be executed when the root shell has exited (which won't happen unless you switch to it and do it manually). You should do something like this instead:
Code:
su -c 'command'
for each command that require root privileges, e.g.
Code:
su -c 'ln -s ~/some_config /etc'
 
Old 07-03-2009, 10:02 PM   #6
Sylvester
LQ Newbie
 
Registered: Jun 2009
Posts: 27

Original Poster
Rep: Reputation: 15
Just to share my latest efforts in this direction:

The Asus EEE PC 901 go has hidden in the battery compartment a slot for inserting a Sim card. So it is possible to get an Internet dongle, take out the Sim card and insert it.

Getting Incognito to correctly connect to this Internet connection might be a marathon -- I don't have any idea where to start. I am guessing lspci would find it and wvdial with the correct settings might get it working. I'm sure it won't be long before someone has figured it out.

So for the time being I'm investigating running incognito as the virtual machine inside XP -- seeing as XP software is installed by default for connecting to the Internet through this little device.

However, I will keep posting to the forum as I figure out some solution.

Sy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
zigbee usb dongle... ramesh6056 Linux - Software 7 10-19-2009 05:44 PM
Bluetooth USB dongle NDR008 Linux - Hardware 1 01-07-2007 05:52 PM
super slow responce when trying to use Internet (USB dongle) Koop Linux - Hardware 1 12-27-2006 05:54 AM
How will i dialup internet with a dongle from kde arunbabu Linux - Networking 2 11-06-2005 10:58 AM
usb bluetooth dongle zbrox Linux - Hardware 1 04-28-2005 03:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Incognito

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration