UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What (physically) is /mnt/cdrive? Is it an external hard drive or something like that? What filesystem is if formatted as?
And why is it under /mnt ?
Ken
I have a 500GB hard drive divided in two partitions: the first (64 GB) is where Ubuntu is installed and the second (436 GB) is for storage only. Both are formatted in ext4. /mnt/cdrive is where the second partition is mounted. It is under /mnt because I followed prayag_pjs's suggestion so that the second partition would be mounted by default on startup (http://www.linuxquestions.org/questi...tartup-843682/).
I am not sure I can explain exactly why this happens. I think it has to do with the umask value for the guest user account used by Samba. Anyhow, here is how I reproduced your problem.
I created the share point exactly as you described yours. I then set the permissions on Downloads thusly
ken@taylor12:/$ ls -l "/mnt/cdrive/shared sf/Joćo/"
total 4
drwxrwxrwx 5 root root 4096 2010-12-27 14:23 Downloads
I then created 3 subdirectories under Downloads as follows
by_ken_on_Ubuntu - created with Nautilus on the Linux machine while logged on with my account ken
by_ken_on_XP - created via Samba from an XP box using Windows explorer - I was logged onto XP as ken with a password matching my password (actually my smbpasswd but it is synched) on the Linux box
by_moe_on_XP - created via Samba from an XP box using Windows explorer - I was logged onto XP as moe. moe does not have an account on the Linux box so moe is accessing the Downloads directory as a guest.
So now lets look at the results
Quote:
ken@taylor12:/$ ls -l "/mnt/cdrive/shared sf/Joćo/Downloads"
total 12
drwxr-xr-x 2 ken ken 4096 2010-12-27 14:17 by_ken_on_Ubuntu
drwx------ 2 ken ken 4096 2010-12-27 14:20 by_ken_on_XP
drwx------ 2 nobody nogroup 4096 2010-12-27 14:23 by_moe_on_XP
Notice that I, ken, own the directories I created and thus I can do with them as I please. As moe is not present on the Linux box the directory by_moe_on_XP is not owned by anyone. I have no permissions to access or do anything with it. Of course root (using sudo) can do anything desired with the un-owned directory.
In my case Nautilus shows a lock icon on the folder by_moe_on_XP. cut and copy are not grayed out. However, if I try to copy or cut the directory I receive a message that
Quote:
The folder "by_moe_on_XP" cannot be handled because you do not have permissions to read it.
Please read the output from the "ls" command in my previous reply: "Today, 07:42 PM". Let's call the first listed folder "folder_a". This folder appears on Nautilus with a lock emblem. The option "cut" is not grayed out for "folder a" and it's not this folder I would like to move. The folder (in this case folders) I would like to move are folder_a's sub-folders (note that for these sub-folders the "cut" option is grayed out and they don't have any emblem on them).
What can I do so that I don't have to use chmod all the time (every time someone at my home copies/moves a folder from a PC/laptop with Windows to "shared sf" (the shared folder in Ubuntu))? (issue_at_hand)
Answering your message: "Does this help?", I didn't understand from your conclusions how can I solve issue_at_hand.
Thank you for your time! I really appreciate that you're spending this time helping me.
I must have been testing and writing my last response while you were posting the ls output. It appears that all of the files and subdirectories (except for BTNext) under Downloads are owned by a user account called sf. Who is sf? Is that the account which you use to access the Ubuntu machine? If so, you should be able to cut, copy and paste any of the other items in Downloads. It appears that the problem is with the BTNext subdirectory. How about it we try the following:
Quote:
ls -l "/mnt/cdrive/shared sf/Joćo/Downloads/BTNext"
I think this will give you an error. Then change the permissions on BTNext
Next try the ls command again. I don't need all the results of the ls, just a representative example or a couple if there are different permissions to the files and subdirectories within BTNext.
And a request... Please refer to the subdirectories or folders by their real names. I am getting confused trying to keep track of what is folder_a and what is folder a.
A couple of other pieces of information would help.
Quote:
ls -l /mnt
and
Quote:
ls -l "/mnt/shared sf"
and
Quote:
ls -l "/mnt/shared/ sf/Joćo"
That will complete the security picture of the whole shared directory (or folder) structure.
Should I still follow the instructions you mentioned after "I think this will give you an error." (including changing BTNext's permissions with chmod, re-running the ls command and running the 3 ls commands - "ls -l /mnt", "ls -l "/mnt/shared sf"" and "ls -l "/mnt/shared/ sf/Joćo"")?
Step 0 - Write in large print and tape to your monitor "Group membership changes do not take effect until the user logs out and back in!!!!!!!!!! (I spent an hour screwing with this until I finally logged out of the Linux machine and back in)
Step 1 - edit the following section of /etc/samba/smb.conf
Quote:
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0700
Change to 0775 as the instructions say.
Step 2 - restart Samba
Quote:
sudo smbd restart
Step 3 - Add your account, sf, to the group nogroup
Quote:
sudo usermod -a -G nogroup sf
Step 4 - logout and back in with your user account sf
Step 5 - make sure permissions are good on the key subdirectories
Step 6 - Copy some new folders and files from a Windows machine to the Downloads subdirectory on the Samba share
Now see if you can move the folders and files as you desire. If that works OK here are a couple of handy scripts to clean up the permissions on all the stuff in BTNext. I can not claim authorship on these. I came across them somewhere - apologies to the original author.
Quote:
to change permissions recursively for ALL files under the present directory
sudo find . -type f -exec chmod 644 {} \;
same idea for dirctories
sudo find . -type d -exec chmod 755 {} \;
I have done every step up to Step 6, but when I tried doing what you requested me: "Now see if you can move the folders and files as you desire." it didn't work; the new folder I have copied to the Downloads subdirectory - "villa" is behaving the same way as the BTNext folder: it has the lock emblem and the files inside it have the "cut" option grayed out.
Please have a look at /etc/samba/smb.conf. The original file as created by the samba install has the mask lines commented out. Make sure you have removed the ; at the beginning of each line. Otherwise the desired permissions will not be set on files and folders coming from the Windows side.
Quote:
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775. ; create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775. ; directory mask = 0700
If you need to edit smb.conf remember to do a sudo smbd restart after completing the edit.
sf@SF-desktop:~$ ls -l /mnt
total 4
drwxr-xr-x 5 sf sf 4096 2010-11-18 19:01 cdrive
sf@SF-desktop:~$ ls -l /mnt/cdrive
total 20
drwx------ 2 sf sf 16384 2010-11-11 23:45 lost+found
drwxr-xr-x 8 sf sf 4096 2010-11-14 11:35 shared sf
[the next outputs are shortened]
--
sf@SF-desktop:~$ ls -l "/mnt/cdrive/shared sf"
total 48
drwxr-xr-x 27 sf sf 4096 2010-11-14 11:27 Joćo
sf@SF-desktop:~$ ls -l "/mnt/cdrive/shared sf/Joćo"
total 116
drwxr-xr-x 26 sf sf 4096 2010-12-28 13:49 Downloads
sf@SF-desktop:~$ ls -l "/mnt/cdrive/shared sf/Joćo/Downloads"
total 18513624
drwxr-xr-x 2 nobody nogroup 4096 2010-12-28 13:49 villa
sf@SF-desktop:~$ ls -l "/mnt/cdrive/shared sf/Joćo/Downloads/villa"
total 3984
-rw-r--r-- 1 nobody nogroup 567138 2010-07-25 22:39 File1.JPG
-rw-r--r-- 1 nobody nogroup 620946 2010-07-25 22:39 File2.JPG
... and so on until File7.JPG
--
"
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0775
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0775
"
to
"
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0775
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0775
"
then, after saving the file, I restarted Samba with the command you said: "sudo smbd restart" and even logged off and logged in back again on Ubuntu, but nothing has changed, that is, "villa" is still behaving in this way: it has the lock emblem and the files inside it have the "cut" option grayed out.
The folders and files which were copied to the samba share with samba running with the incorrect smb.conf file took on their permissions at that time and those permissions will stay with the folders and files until they are changed. If you still have the files on the Windows machine try deleting them from the samba share and copying them again from windows. Or copy them from the samba share to the Windows machine, delete them from the samba share and copy them back from Windows to the samba share.
The permissions on villa should be
Quote:
drwxrwxr-x 2 nobody nogroup 4096 2010-12-28 13:49 villa
and the permissions on the files inside of villa
Quote:
-rw-rw-r-- 1 nobody nogroup
This will allow all members of the nogroup group to delete the items.
There is a little problem: when trying to copy another folder - villa2 - from a Windows XP PC to the Downloads folder on Ubuntu (the one inside "\mnt\cdrive\shared sf\Joćo"), the following error appeared:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.