Saturday, January 24, 2015

Mount Moto G2 in Fedora 20

For some reason on my desktop, plugging in the MotoG2 didn't auto mount it. With the Netbook I had got this to happen automatically.

But my terrible memory meant that I forgot what I did. So once again I was searching for a way to get this resolved when I found this site.

The site had detailed instruction on getting an Android phone to mount in Linux. Here's what I did specifically in Fedora 20.

  1. First I installed the relevant packages
    • yum install gvfs-mtp kio_mtp libmtp simple-mtpfs
  2. Then used the command to find the list of phones
    •  simple-mtpfs -l
  3. Finally mount using the following command
    •  simple-mtpfs
  4. To remove, all that was required to do was
    • sudo umount <mount-point-directory>
 As simple as that!

Setting up a restricted Sudoer on Fedora 20

Since my kids also use my primary system, I no longer could give full sudo access to the default family user account and need to ensure that only I could administer the system.

On a previous occasion I had manually edited the /etc/sudoers file. But this time I learnt about a command called visudo.

The visudo command is similar to vi with the added benefit that when the editor is closed it also validates the file.

My main aim was to enable using the truecrypt utility from the normal user rather than from root.

With the help of this command I was able to make the change to the sudoers file. Below I've listed all the options I tried with my understanding of why they worked or didn't.

  1. I create an alias for all the commands I wanted to be able to run as a normal user. This is a short cut instead of having to use this list when granting users permissions
    • Cmnd_Alias TRUECRPT = /bin/mount, /bin/umount, /usr/bin/truecrypt
  2. Next step was to all the specific user access. In this example, username is the login user.
    • username    ALL=(ALL)       ALL
      • The command resulted in the user being able to run all the commands after being prompted for the username's password.
      • This was the previous setting that I wanted to remove.
    • username   ALL=(TRUECRPT)
      • This enabled only the relevant commands to be run by the user after the user enter their password when prompted.
    • username   ALL=(TRUECRPT) NOPASSWD: ALL
      • This resulted in a syntax error detected by visudo
    • username   ALL=(TRUECRPT) NOPASSWD: TRUECRYPT
      • This resulted in a syntax error detected by visudo
    • username   ALL=NOPASSWD: TRUECRPT
      • This was the command was the one that worked for me. It allowed the use of truecrypt and it's automounted partitions to be accessed without prompting the user for passwords.
With this I finally (think) I've understood how to configure sudoers. I'll update this post the next time I need to reconfigure it.