Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Mounting a truecrypt device - wrong File permissions for xbian user
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Mounting a truecrypt device - wrong File permissions for xbian user
2nd Aug, 2013, 08:48 AM
Post: #1
CoilGun12 Offline
Registered
Posts: 2
Joined: Aug 2013
Reputation: 0
Exclamation Mounting a truecrypt device - wrong File permissions for xbian user
Hello,

i have got a problem with mounting my truecrypt device at autostart.

First of all I wrote a bash script:
Code:
#! /bin/sh
truecrypt -k "" -p mypassword --protect-hidden=no /dev/sda2 ~/Videos/
and put the right permissons in sudoers to get truecryt executed without asking for password validation:
Code:
xbian ALL=(ALL) NOPASSWD: /usr/local/sbin/xbian-config, /sbin/halt, /sbin/reboot, /usr/bin/splash, /usr/bin/truecrypt

and put a modified version:


Code:
TC_DEVICE="/dev/sda2"
TC_MOUNT_POINT="/home/xbian/Videos"

test -f /usr/bin/truecrypt || exit 0
. /lib/lsb/init-functions

case "$1" in
start)    log_daemon_msg "Mounting truecrypt dirs" "tc"
        echo
        test -d $TC_MOUNT_POINT || mkdir $TC_MOUNT_POINT
        /usr/bin/truecrypt -p mypassword -k "" --protect-hidden=no $TC_DEVICE $TC_MOUNT_POINT
        log_end_msg $?
    ;;
stop)    log_daemon_msg "Umounting truecrypt dirs" "tc"
        echo
        /usr/bin/truecrypt -d $TC_MOUNT_POINT
        log_end_msg $?
        ;;
*)    log_action_msg "Usage: /etc/init.d/tc.sh {start|stop}"
        exit 2
        ;;
esac
exit 0
to etc/init.d/ then i configured
update-rc.d. It worked so far that the root user had got read and write permissons
on the drive, but the xbian user didnt. I tried it again with different options in
truecrypt but the problem was still the same. In xbmc I cannot access the drive,
because i aint got the right permissons. Changing the permissons with chmod 777 didnt
take any affect on the files at all. Permissons still only for the root user. I tried out
every single runtime level (/etc/rc1-5.d), still no change as well as writing the code into
/etc/rc.local or /etc/init.d/local.tc. It looks like that the code, executed by root wont get the
xbian user permissons for write or read on the device.
If I'm running the script via ssh with the xbian user, there no issues in mounting
and viewing my movies via xbmc.
I thought, well the i try to run the script when the x-server is starting. So I´ll be sure the code is
executed by the xbian user. I created a .desktop file in ~/.config/autostart/mount.desktop and /etc/xdg/autostart/
mount.desktop. Both file were not executed at startup.
Code:
[Desktop Entry]
Name=tc-mount
Comment=Mounting my Movies
Exec=sh /home/xbian/mount_tc.sh
Terminal=false
Type=Application
X-GNOME-Autostart-Phase=Initialization

(wont start with and without the last line Wink )

So my question would be what do you recon to use for autostart or how could i get the right permissons to view my movies
in xbmc?
I do not want to connect a keyboard to my RasberryPi or execute the script via ssh. It has to start every boot. Is there a
possibility to run sh scripts via xbmc? I didnt find any addon that would do something like that for me. Or maybe
start xbmc as root on startup? How can i do that?
I hope that are not too many questions...Smile

Thanks.
Find all posts by this user
Quote this message in a reply
2nd Aug, 2013, 10:15 AM
Post: #2
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
Re: Mounting a truecrypt device - wrong File permissions for xbian user
Add it to a startup cronjob.

See this: http://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
2nd Aug, 2013, 03:21 PM
Post: #3
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: Mounting a truecrypt device - wrong File permissions for xbian user
(2nd Aug, 2013 08:48 AM)CoilGun12 Wrote:  i have got a problem with mounting my truecrypt device at autostart.

coilgun, it doesn't matter, which user calls your scripts. as soon as any command is "sudoed", effective user id and group id is 0.

but this is not a problem. effective user permissions are not related to truecrypt volume, but the fs on top of it.

so unlock the tc volume, then mount it under root. then simply do "chown -Rc xbian:xbian /home/xbian/Videos"

if you intend to use volume on other system (other uid) as well, mount the filesystem with options dmask=0000,fmask=0111 (what effectively creates all new files with chmod 666 and dirs with 777).

mk

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
2nd Aug, 2013, 09:31 PM
Post: #4
CoilGun12 Offline
Registered
Posts: 2
Joined: Aug 2013
Reputation: 0
RE: Mounting a truecrypt device - wrong File permissions for xbian user
thanks mk,

changing the permissions mit chown didnt work, but changing the overall permissions and mounting the options with dmask=0000 and fmask=0111 work out pretty well Smile
So the solution is:

Code:
#! /bin/sh
truecrypt --fs-optons="" -k "dmask=0000, fmask=0111" -p mypassword --protect-hidden=no /dev/sda2 /home/xbian/Videos/

Thanks for the fast reply Smile
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 10th May, 2025, 08:20 AM Powered By MyBB, © 2002-2025 MyBB Group.