On Tue, 19 Aug 2008 12:36:03 GMT
CurvyTail <CurvyTail@no-mx.forums.opensuse.org> wrote:
>
> carboncore;1858943 Wrote:
> > Hi,
> >
> > What about writing the commands to unmount the partitions in one of the
> > root home .bash* files, for example, bash_login?
> >
> > This file is only parsed when logging in, so I think it will do the
> > trick.
> >
> >
> > Regards.
> no, i mean, i’d like to put something in the kde4 autostart folder, so
> that it can be removed when necessary.
>
> btw, how do i write a shell script to unmount partititions ?
>
> thanks for the idea anyway…
>
>
Firstly… logging into the GUI as root is a VERY bad idea. But it’s your
system.
Ok…
Several methods:
It was mentioned that you could make the partitions not automount, but then
you’d forget and leave them mounted from being logged in as ‘curvy’, and then
they’d be there leering at you as root… ok, that’s out.
You could use commands in .bashrc, so that they’d be performed when you log
in as root, regardless of whether you log in via a console, ssh or GUI.
These commands would also work in the GUI, if placed into an executable
script stored in the .kde4/Autostart subdirectory.
We need to remember that you may have VFAT AND NTFS partions in your system.
The magic commands:
umount -t vfat -a
umount -t ntfs -a
If you put those two lines at the end of root’s .bashrc (<—notice the dot),
they’ll be executed ANYTIME root logs in.
(oh pooh! even when you ‘su - root’ stuff too! fun!!)
If you were to save these two lines in a text file as so:
#!/bin/bash
umount -t vfat -a
umount -t ntfs -a
and then
chmod +x myfile
(replace myfile with name of script you just created)
Then save this script into .kde/Autostart directory, they’d be started when
root logs in via KDE4 GUI. (this is probably what you’re looking for)
Something to think about:
If you have flash drives plugged into the system, they’re usually automounted
as needed… they are usually VFAT formatted (not mine!). These commands WILL
unmount those drives too. (oops!)
A better set of commands, which don’t use ‘wildcards’ to umount things would
be:
umount /dev/sda2
umount /dev/sdg4
or where-ever your partitions are mounted at. That would be much better
since it would be a selective pruning.
Oh, and if you’ll accept advice from someone who’s been using linux for a
few months or so…
Try VERY HARD to NEVER EVER EVER LOG IN AS ROOT.
su - … and sudo … are fine… but never STAY as root.
Hope this helps
Loni
–
L R Nix
lornix@lornix.com