LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 12-04-2012, 05:47 AM   #1
tiger.woods
Member
 
Registered: Mar 2006
Posts: 122

Rep: Reputation: 15
SMB - File copy from Windows file permissions changed?


Why when I copy a directory of files from a Windows share using Nautilus and the following smb://ip_of_Windows_Machine/ does it change the file permissions on those files copied over?

To be more specific I am copying over Installation files for 11g and the script files that have been copied now are no longer executable, maybe never were?

Thanks,

Last edited by tiger.woods; 12-04-2012 at 06:10 AM.
 
Old 12-04-2012, 06:18 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Windows does not have the concept of permissions that Linux and Unix have; there is no owner, group and public on Windows files.

If you copy files from Linux to Windows then copy them back there permission masks will be... um, screwy? Sames is true if you simply copy files from Windows: screwy permissions. You can see just how screwy with
Code:
ls -l *
Fixing it is fairly easy. Let's say you've copied a directory tree from Windows named, oh, I dunno, wintree into the /tmp directory on you Linux box.
Code:
cd /tmp
#     first, fix the diretories
find wintree -type d -exec chmod 755 {} \;
#     now, fix the files
find wintree -type f -exec chmod 644 {} \;
What that did was set all the directories to the default mode (755 results in drwxr-xr-x on a directory) and set all the files to the default mode (644 results in -rw-r--r-- on a file).

Now, what about executable shell programs ("scripts")? That depends: if every file in the directory tree should be executable, you could simply do this
Code:
cd /tmp
#    fix every directory and make all files executable
find wintree -exec chmod 755 {} \;
which you probably don't really want to do (won't hurt but, you know, it's not "neat and clean").

You can look though the file names and change the mode of individual files that should be executable to 755 or, if the shell programs are named file.sh you could do this
Code:
cd /tmp
find wintree -type f -name '*.sh' -exec chmod 755 {} \;
(for the life of me I cannot imagine why people using Unix/Linux systems want to have to type a file name extension to execute something but for some reason they like to do that).

Using some combination of the above (plus perhaps a look that the find manual page) you ought to be able to clean up yet another Windows mess (quick and easy).

Note too that you may -- may -- need to use sudo in front of the find above if you're not the owner of the copied tree.

Hope this helps some.
 
  


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
How to copy smb shared file with konqueror? Mitsuhashi Linux - Software 3 07-24-2006 10:38 AM
ICEauthority file permissions mysteriously changed andy_g_gray Linux - Software 0 03-06-2006 02:48 PM
file permissions cant be changed! shishimo Fedora 1 12-04-2004 10:23 AM
FIle permissions changed after power surge..HELP!! spaceagedevice Linux - Newbie 5 06-16-2004 04:45 AM
Something Changed File Permissions anthony114 Linux - Security 2 08-12-2003 08:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 12:58 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