0

I've edited this post to hopefully make it clearer to anyone trying to help

  • drwxr-xr-x [tutorials]

  • -rwxr--r-- [helpguide.txt]

When the above are copied over from the Dell laptop, they appear locked (permission showing "nobody/nogroup") so I would like to change the permission to match the default permission that is applied to each newly created folder/file on the Toshiba laptop.


What I discovered is that any new folder and new file created on the Toshiba laptop get:

  • permission for folders: drwxrwxr-x

  • permission for files: -rw-rw-r--

When copying/moving a folder containing files Dell laptop:

  • permission for folders: drwxr-xr-x
  • permission for files: -rwxr--r--

2 Answers 2

1

Use

sudo cp -rp /FROM_WHERE /TO_WHERE

From man cp:

-p     same as --preserve=mode,ownership,timestamps

--preserve[=ATTR_LIST]
      preserve the specified attributes (default: mode,ownership,timestamps),
      if possible additional attributes: context, links, xattr, all
3
  • Thanks for the command and explanation. Since the files are already on the destination PC, I'm trying to figure out how to get the folders/files changed from the "nobody/nogroup" permissions.
    – Peter
    Mar 18, 2013 at 21:19
  • I'm not sure if we're on the same page, but, you should have a visit at this page here .Should give you some explanation on file permissions
    – AFwcxx
    Mar 19, 2013 at 19:20
  • It sounds like to accomplish what I want, I will need to chmod 644 to all the files and chmod 775 to all the folders that were copied over since that will give it the default that is applied to all newly created files on Ubuntu. Is that correct?
    – Peter
    Mar 20, 2013 at 17:58
0

if you changing permisions only for files, than first you need to know what means rules for permissions. you have 777 for example, where first number 7 is rule for owner of the file, seccond number 7 is permission for group of users that own that file, band third number 7 is for anyone, declares roules for anyone on this planet :D now when you know what that 3 number means, you need to know how to built that numbers. you have permissions writte, which has value of 4, than you have read permission, which has value of 2, and the last one is execute permission which has value of 1. so number 7 means permission to: writte, read and execute, than if you have number 5, that means writte and execute....

now, if you want roule for some file to be, owner to has all privilegies, group read and execute, and anyone to read and execute, you will have number of 733.

now when you understand how to combine that numbers, it is time to know commands for changing permissions and ownership:

chmod xxx /filelocation (filelocation is path of file that you changing permissions) (xxx is combination of numbers that declares permission, you need to find rule number by combining numbers as explained above)

if you want to change owner of that file, you need to writte:

chown userthatyouwantasowner /file (that means that owner of that file will be given user instead of userthatyouwantasowner)

the next thing, if you making permission changes for folders, it is same as files, but not at all. if you want to add some rule for some folder, but only that folder, than writte:

chmod xxx /folder (folder or folder path example /var/www )

and difference is, if you want to change permission for that folder, and all content inside of that folder (subfolders, and folder files), you need to writte:

chmod xxx /folder -R (-R stands for recursive=applying changes to entire content of folder)

for changing owner of folder, just replace chmod with chown in both cases, and thats all.

if you liked my answer please comment, and remember, if you are not using terminal as root user logged, then before any comand you need to writte sudo (to tell to computer that sudo(superuser do))!!!!!

hope this will help you!!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .