LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 12-27-2010, 01:34 PM   #16
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16

Quote:
Originally Posted by taylorkh View Post
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/).
 
Old 12-27-2010, 01:42 PM   #17
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by taylorkh View Post
Try Linux slashes not Windows slashes
With this suggestion, this time the "ls" command worked.

You can find the output on http://www.text-upload.com/read.php?id=36630&c=4653048 (available only in the next 7 days for privacy reasons).
 
Old 12-27-2010, 01:44 PM   #18
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
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
Quote:
sudo chmod 777 "/mnt/cdrive/shared sf/Joćo/Downloads"
The result is
Quote:
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.
Does this help?

Ken
 
Old 12-27-2010, 02:08 PM   #19
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
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.
 
Old 12-27-2010, 03:39 PM   #20
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
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
Quote:
sudo chmod 777 "/mnt/cdrive/shared sf/Joćo/Downloads/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.

Ken
 
Old 12-27-2010, 04:22 PM   #21
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
"Who is sf? Is that the account which you use to access the Ubuntu machine?"

Yes.

"I think this will give you an error."

It didn't. Here's the output:

--
sf@SF-desktop:~$ ls -l "/mnt/cdrive/shared sf/Joćo/Downloads/BTNext"
total 16
drwxr-xr-x 2 nobody nogroup 4096 2010-11-25 03:30 Death.At.A.Funeral.2010.CUSTOM.PT.SUBS.NTSC.DVDR-CLD
drwxr-xr-x 2 nobody nogroup 4096 2010-11-25 03:31 Exame Informįtica - Agosto 2010
drwxr-xr-x 2 nobody nogroup 4096 2010-11-25 03:19 Exame Informįtica - Soluēões Agosto 2010
drwxr-xr-x 4 nobody nogroup 4096 2010-11-25 03:30 VA_-_Noite.pt_Summer_2010-PROPER-PT-2CD-2010-NoGrp
--

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"")?

Last edited by 512upload; 12-27-2010 at 04:23 PM.
 
Old 12-27-2010, 06:33 PM   #22
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
OK - I think I have the answer.

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
Quote:
sudo chmod 777 "/mnt/shared sf"
sudo chmod 777 "/mnt/shared sf/Joćo"
sudo chmod 777 "/mnt/shared sf/Joćo/Downloads"
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 {} \;
Let me know if we are getting closer.

Ken
 
Old 12-28-2010, 08:02 AM   #23
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
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.
 
Old 12-28-2010, 11:27 AM   #24
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
Please verify the permissions of the various folders as described previously
Quote:
ls -l /mnt
ls -l "/mnt/shared sf"
ls -l "/mnt/shared/ sf/Joćo"
ls -l "/mnt/shared/ sf/Joćo/villa"
and let me know what you find. villa should show drwxrwxr-x 2 nobody nogroup

Also verify that you (sf) are a member of nogroup
Quote:
egrep "^nogroup" /etc/group
I am running Ubuntu 10.04. Just in case something is different and strange in 10.10 I will setup the same Smaba environment on 10.10.

Ken
 
Old 12-28-2010, 12:10 PM   #25
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
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.

Ken
 
Old 12-28-2010, 01:47 PM   #26
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
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
--

sf@SF-desktop:~$ egrep "^nogroup" /etc/group
nogroup:x:65534:sf
 
Old 12-28-2010, 01:59 PM   #27
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
Thanks for the tip! I didn't know that about ";".

I have now made the change on smb.conf from

"
# 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.

Last edited by 512upload; 12-28-2010 at 02:00 PM.
 
Old 12-28-2010, 02:05 PM   #28
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
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.

Ken
 
Old 12-28-2010, 03:24 PM   #29
512upload
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 137

Original Poster
Rep: Reputation: 16
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:

http://img143.imageshack.us/img143/5028/villa2.gif

Last edited by 512upload; 12-28-2010 at 03:29 PM.
 
Old 12-28-2010, 04:34 PM   #30
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
I would recommend opening up the permissions on the shared folders as follows
Quote:
sudo chmod 777 "/mnt/cdrive/shared sf"
sudo chmod 777 "/mnt/cdrive/shared sf/Joćo"
sudo chmod 777 "/mnt/cdrive/shared sf/Joćo/Downloads"
That should let any user create new folders and files on the samba share.

Ken
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Network sharing folder cheesewizz Linux - Networking 4 05-27-2009 12:08 PM
Sharing a folder between two network computers reverse Debian 2 08-14-2007 11:05 AM
window xp sharing folder on a network blackzone General 1 09-10-2006 06:34 PM
Debian and Sharing Windows Folder gibran Linux - Networking 3 09-18-2005 12:45 PM
Sharing Windows Folder Caveman Linux - Newbie 5 09-26-2003 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration