Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 2 [3] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Auto mounter script., Mounts partitions for specified users.< Next Oldest | Next Newest >
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Sep. 30 2006,00:21 QUOTE

True. I plan it 'optimeze' my script when I can get jEdit. ;)

--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Nov. 06 2006,09:51 QUOTE

I made a new feature to my script.
It searches for .mount.exec file from $PARTITION. If found then sources it.
This is handy when you have some programs on your hd that you want to run automatically on startup.
I run my eggdrop that way. =) Yes. There's then a big security hole, but I managed to avoid it by then moving .mount.exec and .mount.conf files to another directory and make it accesible only by root. Of course script will move those files back on shutdown/reboot.

Anyway this script still needs optimizing and features. For example (un)mounting only one partition.
I'll be posting more later...


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 06 2006,15:11 QUOTE

The autorun is, or at least can be, a useful idea.

You might be able to avoid moving and replacing files by mounting the drive without executable permission and running a copy of the file instead of the original.  This way you won't need to bother moving the files back....it will allow the file to continue working after a crash, or on a cdrom.
Just some thought food.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: April 16 2007,12:08 QUOTE

I think too that moving and/or copying those files is unnecessary.

I think script should look if modes of the file are 500 and owner is root, then if both are true then source it.
Any suggestios how to read permissions and owner of a file? I can't (at least at the moment) figure out anything expect `ls -l` and it would need some "dirty" parsing.


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: April 19 2007,15:45 QUOTE

Correction to previous post: mode should be 600.

Anyway I managed to do a neat function to check root priviliges:
Code Sample
function crootp () {

 # crootp: short for check root priviliges
 # user and group must be root and permissions must be 600
 [ -f $1 ] && [ -G $1 ] && [ -O $1 ] && [ `stat -c %a $1` -eq "600" ]

}


It's usage is quite simple:
Code Sample
if crootp $FILE
then
 echo FIle is only accessible by root
else
 echo File does not exist or permissions are incorrect
fi


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
14 replies since July 28 2006,05:27 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 2 [3] >/
reply to topic new topic new poll
Quick Reply: Auto mounter script.

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code