Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a backup drive that is Truecrypt Encrypted. I'd like to automnt this drive so I can automate backups when in the office. I am using Linux Mint 12 x64bit

I wrote a script that runs successfully with Sudo to mount the encrypted drive.

However, I can not get the drive to mount automatically...

I tried entering the script into rc.local, but that doesn't work.

So I tried editing the sudoers file (thinking I could enter this script into the startup applications area for Mint):

username ALL= NOPASSWD: /usr/local/bin/bakmnt.sh

*username is replaced with my real my username in the sudoers file

Still, when I try to run the script without sudo, I get:

Error: Failed to obtain administrator privileges.

I'm out of ideas, googling around seems to be an issue with Truecrypt..but I still come up empty for a solution. Any thoughts out there?

thanks for reading!!

share|improve this question
    
Did you try putting the drive in /etc/fstab? –  Kevin Jan 19 '12 at 21:45
    
I did not, as I understand it, there is no way to specify a password so the truecrypt partition will not mount under fstab. –  Awhitehatter Jan 19 '12 at 21:54
    
so how do you supply password to mount it? –  yarek Jan 19 '12 at 22:31
    
"Still, when I try to run the script without sudo, I get..." if you added yourself to the sudoers, you should be using sudo. I'm confused. –  Patrick Jan 19 '12 at 23:24
    
@yarek, it's part of the bash script I wrote. –  Awhitehatter Jan 20 '12 at 0:20
show 3 more comments

1 Answer

up vote 1 down vote accepted

Using sudoers is crock upon hack upon kludge; don't do that. rc.local (or a separate file in init.d) is the correct place to do this. Capture the output of your script when run from there and determine why it is failing. That should give you information you need to fix the script so that it works from rc.local.

share|improve this answer
    
Okay, I accept that. Any guesses where the output would log for rc.local? It isn't working and I can find a log for it. –  Awhitehatter Jan 20 '12 at 19:03
    
rc.local is run as a sh script, so you can do output redirection in there; bakmnt.sh > /tmp/foobar 2>&1 –  Kyle Jones Jan 20 '12 at 19:38
    
Bingo!!! I didn't realize you that rc.local ran as sh script, very cool. The problem was a permissions issue with my key file. Fixed that and we are all set...thanks a million!! –  Awhitehatter Jan 20 '12 at 21:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.