[Solved] How to switch from /media/UserName to just /media

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

[Solved] How to switch from /media/UserName to just /media

Postby Tim44 on Sat Aug 23, 2014 8:59 pm

A couple of years ago, I had installed Linux Mint 11 in an ASUS laptop Intel i7 64 bit environment that dual boots to Windows 7 Professional, and have only now gotten around to upgrading to Mint 17 cinnamon.

In Mint 11, all my "external" files (for lack of a better name) could be found in "/media". For example "/media/Data_Files/ (etc.)" and "/media/LaCie-Backup/ (etc.)" Now, in Mint 17, they are appearing as "/media/tim/Data_Files/ (etc.)" and "/media/tim/LaCie-Backup/ (etc.)" In other words, my User ID has been inserted into all of the directory paths. (In case it's relevant, the "Data_Files" are NTFS so Windows 7 can access them in an emergency.)

What are the implications? For example, if I was to set up another User, such as "susan", would that mean the new User wouldn't be able to get to the "Data_Files" and the "LaCie-Backup" folders unless I did a "chmod" on everything, since the current security is "drwx------"

Essentially, my question is What do I have to do to drop the User (i.e. "tim") from the "/media" path, as it sure appears I'd be in for trouble, otherwise, when adding another User?

Thanks! Tim
Last edited by Tim44 on Sun Sep 07, 2014 1:45 pm, edited 1 time in total.
Tim44
Level 1
Level 1
 
Posts: 11
Joined: Thu Mar 08, 2012 2:56 pm
Location: Atlanta, Georgia, USA

Linux Mint is funded by ads and donations.
 

Re: How to switch from /media/UserName to just /media

Postby ofb on Sat Aug 23, 2014 9:05 pm

Look into Users and Groups. I think what you actually want in Linux terms is to open Group permissions on those directories, and make sure the new users are members of your group.
ofb
Level 4
Level 4
 
Posts: 391
Joined: Fri Jun 13, 2014 1:25 pm

Re: How to switch from /media/UserName to just /media

Postby WharfRat on Sat Aug 23, 2014 9:07 pm

Tim44,

What you are experiencing are changes to the way udisks mounts partitions.

The way around it is to create the mount points in /media and add an fstab entry for them. They will mount automatically. If you don't want that you can add the noauto option to mount them manually.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4276
Joined: Thu Apr 07, 2011 8:15 pm

Re: How to switch from /media/UserName to just /media

Postby Tim44 on Sat Aug 23, 2014 9:22 pm

WharfRat, you appear to have the sense of my question... First, am I understanding your comment about udisks to mean that the Ubuntu / Mint folks have taken a new approach since Mint 11, and that "UserName" has become a required entry in the the directory pathways? If so, then on to Question 2: Can you give this relatively inexperienced fellow some guidance (or a link) about how to create mount points and how to modify the "fstab" file?

Thank you, Tim
Tim44
Level 1
Level 1
 
Posts: 11
Joined: Thu Mar 08, 2012 2:56 pm
Location: Atlanta, Georgia, USA

Re: How to switch from /media/UserName to just /media

Postby WharfRat on Sat Aug 23, 2014 9:45 pm

Yep, you can place the blame squarely on the ubuntu developers.

This is what you have to do. I'm using /media/win7 as the mountpoint and for the fstab entry since you said your files are an a NTFS partition.

In the terminal:

Code: Select all
sudo mkdir /media/win7


Get the UUID of the partition with

Code: Select all
sudo blkid


Open the file /etc/fstab using your text editor with escalated privileges. I'm showing pluma here that comes with the mate desktop

Code: Select all
sudo pluma /etc/fstab&


Change the following to match your UUID and mountpoint and add it to the end of the file.

Code: Select all
UUID=B05E98FC5E98BD12                  /media/win7         ntfs-3g         defaults,noatime,utf8,dmask=007,fmask=111,uid=1000,gid=1000   0 0


Save and close the file then in the terminal

Code: Select all
sudo mount /media/win7


That entry will auto mount the partition at boot. Use whatever name you want for the mountpoint. Just make sure it matches what's in fstab

Good luck :wink:
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4276
Joined: Thu Apr 07, 2011 8:15 pm

Re: How to switch from /media/UserName to just /media

Postby Tim44 on Sat Aug 23, 2014 10:16 pm

WharfRat, thanks for the good, clear instructions! It's going to be tomorrow afternoon before I can give them a try, so it'll be a while before you hear back from me.

In the meantime, I do have a couple of questions: For the sake of discussion and using "win7", that file/folder/partition is already being opened with a "/mount/tim/win7" (actually "/mount/tim/Data_Files"). First, will I need to do anything to stop it from continuing to open that way? Or, do your fstab modifications fool Mint 17 into opening the file as "/mount/win7" while still also opening it as "/mount/tim/Data_Files"? Second, will the security settings on "drwx------ 1 tim tim 4096 Aug 22 18:29 Data_Files" (or what will become 'win7") be an issue for other Users, such as "susan"?

In other words, I know exactly what you want me to do. I just don't have a good understanding of their consequences in regard to what will continue to happen to the "old" file (i.e. to Data_Files) and to the old/new security settings - how they will impact any new Users.
Tim44
Level 1
Level 1
 
Posts: 11
Joined: Thu Mar 08, 2012 2:56 pm
Location: Atlanta, Georgia, USA

Re: How to switch from /media/UserName to just /media

Postby WharfRat on Sat Aug 23, 2014 10:59 pm

I think you mean /media/tim/Data_Files not /mount/tim/Data_Files

The fstab mounts take precedence so udisks looks in fstab for an overriding entry. The /media/tim folder will still be there, but no mountpoint for Data_Files will be created.

NTFS partitions are mounted with a fudged permission scheme since there's no such settings in windows. If you want full access for the universe then use

Code: Select all
UUID=B05E98FC5E98BD12                  /media/win7         ntfs-3g         defaults,noatime,utf8,umask=000,uid=1000,gid=1000


You will be the owner, the group will be yours and others permission will be set to full access.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4276
Joined: Thu Apr 07, 2011 8:15 pm

Re: How to switch from /media/UserName to just /media

Postby Tim44 on Sat Aug 30, 2014 10:49 pm

WharfRat, I haven't igmored your advice from last Saturday; I've just had a very busy week.

You're right about the '/media/tim/Data_Files' - I was just getting tired, and made a mental mistake.

Anyway, I've spent at least nine hours banging my head against the wall today. (Ahh...Yes...It feels so good! -- When Mint works, it is great; when I can't find an answer, it is a pain!) I finally thought I had 'fstab' set up correclty, but I've run into a problem with File Permissions, etc.

The original 'fstab' settings (which, of course, don't refer to "Data_Files") generate the following permissions:
Code: Select all
 4 drwx------ 1 tim tim  4096 Aug  2 13:34 Data_Files
52 -rw------- 1 tim tim 50884 Jul 30 15:27 tele.txt

When I make the following 'fstab' modification, I get 766 permissions, as expected, and Nemo and '/media' show the pathway as '/media/Data_Files/ (etc.)', which is exactly what I want:
Code: Select all
UUID=1093967C79DEC6FF   /media/Data_Files  ntfs    nosuid,nodev,blksize=4096,defaults,umask=011    0       0
 4 drwxrw-rw- 1 root root  4096 Aug  2 13:34 Data_Files
52 -rwxrw-rw- 1 root root 50884 Jul 30 15:27 tele.txt

However, when I try to open a text file, such as 'tele.txt', I get a message saying the file has been flagged as "executable". Furthermore, when I try to use 'chmod -v' to change the permissions (after signing in as 'su'), it claims it's made the change, but it hasn't. I didn't use the 'uid=1000' and 'gid=1000' which you recommended, and maybe that's my problem.

Anyway, here are my questions:
1) What is keeping 'chmod' from working?
2) What is causing all the files to be flagged as "executable"?
3) I don't have permissions, as User "tim" to open the files or to drill down into the sub-directories, even though the File Permissions are 766. Why?

Any help will be greatly appreciated! Tim
Tim44
Level 1
Level 1
 
Posts: 11
Joined: Thu Mar 08, 2012 2:56 pm
Location: Atlanta, Georgia, USA

Re: How to switch from /media/UserName to just /media

Postby WharfRat on Sun Aug 31, 2014 12:11 am

I didn't use the 'uid=1000' and 'gid=1000' which you recommended, and maybe that's my problem.

That's part of your problem
1) What is keeping 'chmod' from working?

You can't close a door if you don't have one. There are no such permissions on an ntfs filesystem so how would you store them :?: They are contrived/artificial/pseudo permissions.
2) What is causing all the files to be flagged as "executable"?

They're not. they are 766 by using umask=011 which is 777-011=766 rwx rw- rw-

umask sets the bitmask for file and directory permissions.
3) I don't have permissions, as User "tim" to open the files or to drill down into the sub-directories, even though the File Permissions are 766. Why?

root root owner:group and without the executable set for others, it prevents changing to that directory.

Try

Code: Select all
UUID=1093967C79DEC6FF      /media/Data_Files     ntfs-3g          defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4276
Joined: Thu Apr 07, 2011 8:15 pm

Re: How to switch from /media/UserName to just /media

Postby Tim44 on Sat Sep 06, 2014 2:57 pm

S U C C E S S ! ! !
WharfRat, thanks to the thousands of hours I'm sure you've spent learning Linux and helping others you have given me the answers i needed! I really appreciate your time! I would have never found this on my own.

For the record, here are the relevant parts of '/etc/fstab' that I've modified:
Code: Select all
UUID=d6260537-264c-40c1-aaf2-4ffb54ebbaf3         /media/Windows7-Virtual ext4    noatime,nodiratime,discard,rw,nosuid,nodev,uhelper=udisks2      0       0
UUID=0d96bfcf-622f-4b3c-9bea-896a1b32a9aa         /media/Linux-Virtual    ext4    noatime,nodiratime,discard,rw,nosuid,nodev,uhelper=udisks2      0       0
UUID=93f42969-5e89-4ea2-a7eb-bcc8a6461d04         /media/Virtual-Machines ext4    rw,nosuid,nodev,uhelper=udisks2 0       0
UUID=1093967C79DEC6FF   /media/Data_Files ntfs-3g defaults,noatime,utf8,blksize=4096,dmask=002,fmask=111,uid=1000,gid=1000        0       0
UUID=38F624AF6152223D   /media/Windows7   ntfs-3g defaults,noauto,noatime,utf8,blksize=4096,dmask=002,fmask=111,uid=1000,gid=1000 0       0
For people who have been following this thread, http://manpages.ubuntu.com/manpages/tru ... unt.8.html has been a great source of 'fstab' information.

The following is a bit of explanation for why I did what I did along with some sample File Permissions:

'sda' solid state drive:
'Windows7-Virtual' and 'Linux-Virtual' reside on a solid state drive (and are used by VMware), so I've added 'nodiratime,discard' to minimize wear and tear on the SSD.
See http://apcmag.com/how-to-maximise-ssd-p ... x.htm#null if you'd like more details about SSD performance. -- I could have done more, but was hesitant. I'd be open to any suggestions.
Sample File Permissions:
Windows7-Virtual: "drwxrwxrwx" and "-rw-------" and "-rw-r--r--"
Linux-Virtual: "drwxrwxr-x" and "-rw-r--r--"

'sdb' hard drive:
Virtual-Machines: "drwxrwxrwx" and "-rw-------" and "-rw-r--r--"
Data_Files: "drwxrwxr-x" and "-rw-rw-rw-"
Windows7: "drwxr-xr-x" and "-rw-rw-rw-"
Note that I used 'noauto' to keep 'Windows7' from mounting / opening at boot time, as I seldom reference that partition from Linux Mint.

If you have time to kill, maybe you could enlighten me on what I'm seeing when running the following commands, but I've learned enough in the past couple of weeks to be perfectly happy to remain in my ignorance about the meaning of 'tim:x:1000' and 'tim:x:1000:1000' in the following dumps. Somehow, they appear to have an effect on the choice of 'uid=' and 'gid=' options in 'fstab'.
Code: Select all
# getent group |grep -E "(users|100)"
users:x:100:
tim:x:1000:

# cat /etc/passwd |grep tim
tim:x:1000:1000:Tim,,,:/home/tim:/bin/bash

Thanks again for your excellent help, WharfRat!
Tim44
Level 1
Level 1
 
Posts: 11
Joined: Thu Mar 08, 2012 2:56 pm
Location: Atlanta, Georgia, USA

Re: How to switch from /media/UserName to just /media

Postby WharfRat on Sun Sep 07, 2014 12:32 am

First of all congratulations on getting everything straightened out.

One suggestion I have is not to include blksize=4096 as an option as mount complains about it when mounted from the cl.

Code: Select all
qiana / # mount -t  ntfs-3g -o defaults,blksize=4096 /dev/sda2 /media/win7
WARNING: blksize option is ignored because ntfs-3g must calculate it.


getent group would be equivalent to

Code: Select all
cat /etc/group


grep -E is extending the regular expression to search multiple entries. An easier way is

Code: Select all
getent group|egrep 'users|100'


or you can use

Code: Select all
egrep 'users|100' /etc/group


to get the same results.

Good luck and enjoy :wink:
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4276
Joined: Thu Apr 07, 2011 8:15 pm

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot] and 20 guests