#] #] ********************* #] "$d_SysMaint"'Linux/chown & chmod notes.txt' - [fil, dir] access [local, remote] for script, see "$d_bin"'chown - edit & run.sh' www.BillHowell.ca 23Dec2017 initial # see also : # "$d_SysMaint"'Linux/permissions notes.link.txt' - list of some somewhat-related files #48************************************************48 #24************************24 # Table of Contents, generate with : # $ grep "^#]" "$d_SysMaint"'Linux/chown & chmod notes.txt' | sed "s/^#\]/ /" # ********************* "$d_web"'ProjMini/TrNNs_ART/0_TrNNs_ART notes.txt' - ??? ********************* "$d_SysMaint"'Linux/chown & chmod notes.txt' 01Sep2023 [fil, dir] permissions : 01Sep2023 search "Linux lftp and how do I set permissions?" 08Jun2021 Setting d_webSite permissions for my webSite online before uploading 24Dec2017 $ sudo chmod -R ug-w "/media/bill/RaspPi_ext4_32Gb/ToDos" 22Dec2017 man chmod 01Dec2021 cannot access 'USB VIDEO' drive - why? ?date subject? Dec2017? IMPORTANT! : Chown & chmod don't work well on Fat32 etc formated drives!!! 22Nov2017 couldn't set "read-only for "/media/bill/HOWELL_BASE/Neural Nets/My Reviews/00_Paper review form.odt" #24************************24 #] +-----+ #] Setup, ToDos, #] set d_web permissions : dir 755, fil 644 $ sudo find "$d_web" -type d -print0 | xargs -0 chmod 755 $ sudo find "$d_web" -type f -print0 | xargs -0 chmod 644 $ sudo find "$d_PROJECTS"'webHtmlOnly/' -type d -print0 | xargs -0 chmod 755 $ sudo find "$d_PROJECTS"'webHtmlOnly/' -type f -print0 | xargs -0 chmod 644 html - users must have executable for directory listings and access to other files by link HOWEVER, on my computer, I want to click on non-executables that I simply txtEdit. A click should NOT launch the browser. Therefore, different chmods : $ sudo find "$d_web" -type f -name "*.html" -print0 | xargs -0 chmod 644 useless? - permissions are not uploaded? $ sudo find "$d_PROJECTS"'webHtmlOnly/' -type f -name "*.html" -print0 | xargs -0 chmod 755 +-----+ text - 644 OK to click to open in txtEditor, but online it has to pen in browser from link-click Therefore, to keep it simple & always use 755 $ sudo find "$d_web" -type f -name "*.txt" -print0 | xargs -0 chmod 755 shell files : I generally need 644 so they don't ask to be [run, display] they just open in txtEditor. I'm not sure if this will work online? $ sudo find "$d_web" -type f -name "*.sh" -print0 | xargs -0 chmod 644 13Sep2023 WAIT!! I doen't want anything executing on my webSite server??!?!?!!!! executable files without extensions - DON'T given them 755 (NO executable!!??) (that I want to execute regularly, not for [occasional, rare] usage.) : $ sudo chmod 644 "$d_bin"'linux' $ sudo chmod 644 "$d_bin"'qnial' $ sudo chmod 644 "$d_bin"'start' +-----+ 644 means: 6: the owner of the file/directory can read and write, but not execute. Since files are not executable, you don't need to have "x" rights here (6 means r+w. 7 means r+w+x). 44: The group that the file/directory belongs to (see the group by using ls -l) and everyone else (the public) are able to read the file, but not execute or write to it (permission number 4). 711 means: (13Sep2023 emfrm William Astle: dir 755, fil 644) 7: the owner of the file/directory can read, write, and execute. This is needed for directories! Without "execute" when you try to list the directory you'll get permission denied. 11: The group that the file/directory belongs to and the public have execute rights only. This is suitable for directories where you don't want other people browsing through the contents but do want to give them access to selected files further down the directory. 755 means: 7: the owner of the file/directory can read, write, and execute. 55: The group that the file/directory belongs to and the public have read and execute permissions but not write. This allows users to be able to view what files are in a directory, and be able to read those files, but not alter them. +-----+ #] online webSite permissions via [lftp, FileZilla, ssh] root directory: DO NOT change permissions! /billhowell.ca = https://www.BillHowell.ca this prevents access by even the server!!!!! dir 755, fil 644 13Sep2023 emfrm William Astle confirms what others have said permissions-by-fileExtension : [lftp, FileZilla] : no-can-do waste of time] ssh : Astle of Lexicom.ca says many system administrators have really messed up with that access. 13Sep2023 em[to, frm] William Astle: Would be nice to run ssh to set permissions by file-extension. Astle of Lexicom.ca says many system administrators have really messed up with that access. If I set permissions in "$d_PROJECTS"'webHtmlOnly/', is this applied to upload? >> NYET +-----+ partial show of permissions: Owner: bill- Bill Howell group: root Permissions read write execute Folder owner y y y group y n y others y n y File owner ? ? ? group ? ? ? others ? ? ? #24************************24 #] +-----+ #] Instructions must do BOTH [chown, chmod]!! 26Jan2022 $ sudo chown -R bill:bill "/run/media/bill/9e05b040-df7b-4e71-936b-1f7c459b8842" 21Jan2021 $ sudo chown -R bill:bill "/media/bill/Dell2" 20Dec2020 $ sudo chown -R bill:bill "/media/bill/Linux_iso" 18Sep2020 $ sudo chown -R bill:bill "/media/bill/12526c35-d097-48a4-b120-f7f59649252c" 04Sep2019 $ sudo chown -R bill:bill "/media/bill/RaspPi" 21Jan2018 Midas USB (was SWAPPER) $ sudo chown --recursive bill:bill "/media/bill/Midas" 24Dec2017 $ sudo chmod -R ug-w "/media/bill/RaspPi_ext4_32Gb/ToDos" 24************************24 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] ??Jan2024 08********08 #] 24Jan2024 [chown, chmod] new hard drive WD6Tb_240124 Note : file permissions are important! There may be many specialized settings for projects etc!! from : "$d_SysMaint"'drives - disk & USB memory/0_[disk, USB] drive notes.txt' GParted Tb /dev/sdb/ 5.46 /media/bill/9e05b040-df7b-4e71-936b-1f7c459b8842 6.0 TB Volume - simply long thing above /dev/sdb2/ 5.46 Seagate_6Tbb ext4 /dev/sdc 5.46 /media/bill/4c09623b-6676-40a4-bb9e-4750f0dcff11 /media/bill/WD6Tb_240124 /dev/sdc2 5.46 WD6Tb_240124 ext4 nemo filMgr shows 10:43$ sudo chown -R bill "/media/bill/WD6Tb_240124" [sudo] password for bill: ~ +-----+ chmod - leave at default for now Owner: bill- Bill Howell group: root Permissions read write execute Folder owner y y y group y n y others y n y File owner ? ? ? group ? ? ? others ? ? ? 08********08 #] 03Jan2024 set bill as owner of RaspPi USB memory stick GPArted to format ext4, labe USB as RaspPi 17:58$ sudo chown -R bill "/media/bill/RaspPi" 08********08 #] 13Sep2023 dir 755, fil 644, DO NOT change at /billhowell.ca level!! William Astle: confirmed setting by most others. Would be nice to run ssh to set permissions by file-extension. Astle of Lexicom.ca says many system administrators have really messed up with that access. 08******s**08 #] 12Sep2023 search "Linux and how do I set permissions for a file extension on a web site?" I think I need to log on to my public website - maybe I can do that? see "$d_SysMaint"'ssh/0_ssh notes.txt' 08********08 #] 12Sep2023 nyet: search "Linux and how do I set permissions on a web site?" Wait - if I do this in "$d_PROJECTS"'webHtmlOnly/' is this applied to upload? >> NYET +-----+ https://itconnect.uw.edu/tools-services-support/storage-hosting/shared-web-hosting/files-and-permissions/setting-linux-permissions/ Setting Linux Permissions Last updated: January 12, 2023 Resetting Default File and Directory Permissions In theory, as long as your Web directory has the right permissions, new files and subdirectories should inherit the right permissions, too. In practice, however, permissions sometimes need adjustment. Use these instructions to restore the correct permissions to files and directories in your Web directory. Log into your web development server using a terminal emulator. If you’re not sure how to do this, click here for instructions. At the prompt, enter the following command to move into your Web directory: cd public_html If you want to change permissions of a file or directory located within a subdirectory, change directories again as needed. Use the chmod command to apply new permissions to your file or subdirectory. HTML files, images, and other “content” files need only to be world-readable. To reset the default permissions of a file, enter the following command at the shell prompt: chmod 644 Substitute your filename accordingly. Do not enter the “<” and “>” characters. CGI programs need to be executable by you. Use the following command to set the default permissions for these files: chmod 744 .cgi Again, substitute your filename accordingly. Do not enter the “<” and “>” characters. Note: files that are read or written by CGI programs should not be group writable. This poses a security risk and will cause the Web server to respond with a server error (‘Premature end of script headers’). Subdirectories need to be readable and executable by the Web server. To reset the default permissions of a subdirectory, enter the following: chmod 750 www-fixdir -r / Substitute your directory name accordingly. Do not enter the “<” and “>” characters. To learn more about the chmod command, refer to How to Set File Permissions Using chmod +-----+ https://stackoverflow.com/questions/13859799/lftp-how-to-recursively-set-permissions-firstly-by-directory-than-by-file lftp: how to recursively set permissions; firstly by directory than by file Asked 10 years, 9 months ago Modified 8 years, 4 months ago Viewed 6k times +--+ Solution As far as a solution to your problem is concerned, you can try something along the lines of: #!/bin/bash server="ftp.foo.bar" root_folder="/my/path" { { lftp "${server}" <> no help, just a blanket setting not by .html 08********08 #] 01Sep2023 set web-related permissions : for my local [file, dir]s, change LOCAL d_web permissions to : $ sudo find "$d_web" -type d -print0 | xargs -0 chmod 755 $ sudo find "$d_web" -type f -print0 | xargs -0 chmod 644 html - users must have executable for directory listings and access to other files by link HOWEVER, on my computer, I want to click on non-executables that I simply txtEdit. A click should NOT launch the browser. Therefore, different chmods : $ sudo find "$d_web" -type f -name "*.html" -print0 | xargs -0 chmod 644 $ sudo find "$d_PROJECTS"'webHtmlOnly/' -type f -name "*.html" -print0 | xargs -0 chmod 755 text - 644 OK to click to open in txtEditor, but online it has to pen in browser from link-click Therefore, to keep it simple & always use 755 $ sudo find "$d_web" -type f -name "*.txt" -print0 | xargs -0 chmod 755 shell files : I generally need 644 so they don't ask to be [run, display] they just open in txtEditor. I'm not sure if this will work online? $ sudo find "$d_web" -type f -name "*.sh" -print0 | xargs -0 chmod 644 executable files without extensions (that I want to execute regularly, not for [occasional, rare] usage.) : $ sudo chmod 755 "$d_bin"'linux' $ sudo chmod 755 "$d_bin"'qnial' $ sudo chmod 755 "$d_Qroot"'nial7_LMDE64' $ sudo chmod 755 "$d_bin"'start' 644 means: 6: the owner of the file/directory can read and write, but not execute. Since files are not executable, you don't need to have "x" rights here (6 means r+w. 7 means r+w+x). 44: The group that the file/directory belongs to (see the group by using ls -l) and everyone else (the public) are able to read the file, but not execute or write to it (permission number 4). 711 means: 7: the owner of the file/directory can read, write, and execute. This is needed for directories! Without "execute" when you try to list the directory you'll get permission denied. 11: The group that the file/directory belongs to and the public have execute rights only. This is suitable for directories where you don't want other people browsing through the contents but do want to give them access to selected files further down the directory. 755 means: 7: the owner of the file/directory can read, write, and execute. 55: The group that the file/directory belongs to and the public have read and execute permissions but not write. This allows users to be able to view what files are in a directory, and be able to read those files, but not alter them. 08********08 #] 01Sep2023 [fil, dir] permissions : $ sudo find "$d_web" -type d -print0 | xargs -0 chmod 755 $ sudo find "$d_web" -type f -print0 | xargs -0 chmod 644 08********08 #] 01Sep2023 search "Linux lftp and how do I set permissions?" from : d_Qndfs 'webSite/webSite maintain [menu, header, footer, body] links, TableOfContents.ndf' # webSite_setChownPublic IS - easy tracking of steps in webRaweSite_doAll # "$d_bin""chown - edit & run.sh" - change file [owner, permissions] # https://www.internalpointers.com/post/right-folder-permission-website # ceck for changes : p_log="$d_log""chown cumulative log.txt" webSite_setChownPublic IS { write 'inside : webSite_setChownPublic' ; host 'sudo find "$d_webSite" -type d -print0 | xargs -0 chmod 755' ; host 'sudo find "$d_webSite" -type f -print0 | xargs -0 chmod 644' ; } apply to my dirs : d_now="$d_PROJECTS"'webHtmlOnly/' later, when it works after testing : d_now="$d_web" $ sudo find "$d_now" -type d -print0 | xargs -0 chmod 755 $ sudo find "$d_now" -type f -print0 | xargs -0 chmod 644 Try FileZilla : go to dir (eg "$d_PROJECTS"'webHtmlOnly/') right-click - File Attributes Numeric value: 755 -> Recurse into subdirectories -> apply to dirs only -> OK right-click - File Attributes Numeric value: 644 -> Recurse into subdirectories -> apply to fils only -> OK search "Linux chmod and what are permissions for web pages with links?" +-----+ https://stackoverflow.com/questions/695497/what-is-the-normal-chmod What is the normal chmod? Asked 14 years, 5 months ago Modified 1 year ago Viewed 54k times +--+ If you want to reset everything, do this command and sort out the consequences. Usually 644 is a good permission for files and 711 is for directories. If you allow directory listings, then use 755. $ find /var/www/html \( -type f -execdir chmod 644 {} \; \) \ -o \( -type d -execdir chmod 711 {} \; \) If you want something less invasive, then just remove the write bits for group and "other". $ chmod -R go-w /var/www/html answered Mar 29, 2009 at 22:31 ashawley >> Best for me! dir 755 file 644 - that is what I settled on with QNial some years ago!!! +--+ Here's a summary that I have gathered: Usage: chmod chmod all files to 644 chmod all .htaccess files to 644 chmod all robots.txt files to 644 chmod all directories to 711 chmod all directories with directory listing (.htaccess Options +Indexes) to 755 chmod all directories that users can upload files to, to 755 (ex: /uploads/). Explanations: 644 means: 6: the owner of the file/directory can read and write, but not execute. Since files are not executable, you don't need to have "x" rights here (6 means r+w. 7 means r+w+x). 44: The group that the file/directory belongs to (see the group by using ls -l) and everyone else (the public) are able to read the file, but not execute or write to it (permission number 4). 711 means: 7: the owner of the file/directory can read, write, and execute. This is needed for directories! Without "execute" when you try to list the directory you'll get permission denied. 11: The group that the file/directory belongs to and the public have execute rights only. This is suitable for directories where you don't want other people browsing through the contents but do want to give them access to selected files further down the directory. 755 means: 7: the owner of the file/directory can read, write, and execute. 55: The group that the file/directory belongs to and the public have read and execute permissions but not write. This allows users to be able to view what files are in a directory, and be able to read those files, but not alter them. There's also an interactive online calculator you can use to figure out what permissions to use: https://chmod-calculator.com/ edited Aug 11, 2022 at 4:59 Nav answered Mar 11, 2015 at 17:47 Katie +--+ They should be as restrictive as possible, but no more. Usually 0644 is a good choice, which gives the owner read and write rights, but everybody else only read. 0755 for directories. But, it can depend on your specific system settings. edited Jul 1, 2014 at 12:43 Gottlieb Notschnabel answered Mar 29, 2009 at 22:23 carl Id 644 going to work for the PHP pages mentioned in the question, or will they need the executable bit set too? Might it depend on the web server and how it's configured? – Steve Jessop Mar 29, 2009 at 23:31 1 No, unless you're doing something really crazy, you don't need the executable bit set for PHP pages. The executable bit allows binary files to be executed and PHP source code is not executable binary. – carl Mar 29, search "Linux chmod and what are permissions for public web pages?" +-----+ https://www.internalpointers.com/post/right-folder-permission-website The right folder permissions for a website on a Linux server Written by Triangles on November 09, 2019 • updated on November 10, 2019 • ID 76 — 3: 750 permissions for everything chmod -R 750 /var/www/my-website.com/ The third command sets the permissions: read, write and execute (7) for the owner (i.e. you), read and execute (5) for the group owner (i.e. the web server), zero permissions at all (0) for others. Once again this is done on every file and folder in the directory, recursively. >> great article! but I'm still confused... search "Linux lftp and how do I set permissions?" +-----+ https://stackoverflow.com/questions/13859799/lftp-how-to-recursively-set-permissions-firstly-by-directory-than-by-file lftp: how to recursively set permissions; firstly by directory than by file Asked 10 years, 8 months ago Modified 8 years, 4 months ago Viewed 6k times >> wow, complicated, convoluted answer +-----+ https://unix.stackexchange.com/questions/26645/why-use-chmod-644-instead-of-chmod-u-rw-go-r Why use `chmod 644` instead of `chmod u=rw,go=r,...`? Asked 11 years, 8 months ago Modified 8 years, 11 months ago Viewed 93k times Guess I've been using octal for too long. 7 is rwx (do anything with it), 5 is rx (gotta read it to execute it), 6 is wr (any data file you need to modify), 4 is r (we'll let you look at it), and 0 is - (sorry, nothing here to see). And the order is Me, Us, Everyone. These are the basic combinations. 755 I can change and run it, everyone else can run it. 644 I can change it, everyone else can read it. 444 Read only for everyone, we're through here. 500 I can execute it, don't want it to change, everyone else hands off. For me, it's short, to the point. 9 characters and a file spec and move on. edited Dec 14, 2011 at 11:49 Martin Geisler answered Dec 12, 2011 at 17:02 Fiasco Labs 08********08 #] 08Jun2021 Setting d_webSite permissions for my webSite online before uploading www.BillHowell.ca -actual settings (via FileZilla look) directories : 770 o:rw- g:rw- o:r-- QNial (2) 775 o:rw- g:rw- o:r-- Steven H Yaskell (1) files : 664 o:rw- g:rw- o:r-- index.html d_webSite -actual settings (via FileZilla look) directories : [create&delete, access, access] QNial (2) [create&delete, none, none] Steven H Yaskell (1) files : [r&w,r,r] index.html d_webRawe -actual settings (via FileZilla look) directories : [create&delete, access, access] QNial (2) [create&delete, none, none] Steven H Yaskell (1) files : [r&w,r,r] index.html (1) by far the most common?? [create&delete, none, none] what is 775-like code? (2) [create&delete, access, access] If I remember correctly - html files must be executable? Howell : from https://linuxize.com/post/chmod-recursive/ below : The most common scenario is to recursively change the website file’s permissions to 644 and directory’s permissions to 755. I ran from terminal - very fast! $ find "$d_webSite" -type d -print0 | xargs -0 chmod 755 $ find "$d_webSite" -type f -print0 | xargs -0 chmod 644 Check results : Yaskedirectory now same as QNial with g:p access $ find "$d_webRawe" -type d -print0 | xargs -0 chmod 755 $ find "$d_webRawe" -type f -print0 | xargs -0 chmod 644 +-----+ https://linuxize.com/post/chmod-recursive/ How to Recursively Change the File's Permissions in Linux Posted Dec 20, 2019 3 min read Using the find Command In general, the files and directories should not have the same permissions. Most files do not require the execute permission, whereas you must set execute permissions on the directories in order to change into them. The most common scenario is to recursively change the website file’s permissions to 644 and directory’s permissions to 755. Using the numeric method: find /var/www/html -type d -exec chmod 755 {} \; find /var/www/html -type f -exec chmod 644 {} \; Using the symbolic method: find /var/www/html -type d -exec chmod u=rwx,go=rx {} \; find /var/www/html -type f -exec chmod u=rw,go=r {} \; The find command searches for files or directories under /var/www/html and passes each found file or directory to the chmod command to set the permissions. When using find with -exec, the chmod command is run for each found entry. Use the xargs command to speed up the operation by passing multiple entries at once: find /var/www/html -type d -print0 | xargs -0 chmod 755 find /var/www/html -type f -print0 | xargs -0 chmod 644 Conclusion The chmod command with the -R options allows you to recursively change the file’s permissions. +-----+ The instructions below >> NOT useful for d_webSite!!!! [750, 755] directories 644 files +-----+ https://www.internalpointers.com/post/right-folder-permission-website The right folder permissions for a website on a Linux server Written by Triangles on November 09, 2019 • updated on November 10, 2019 • ID 76 — Say you have a website running on Linux. What are the correct permissions for the folder that contains the HTML, CSS, images, JavaScript files and so on? 1: set your user as the owner chown -R john /var/www/my-website.com/ This command sets john as the owner of every file and folder inside the directory (-R stands for recursive). 2: set the web server as the group owner chgrp -R www-data /var/www/my-website.com/ This command sets www-data as the group owner of every file and folder inside the directory. Recursive mode, as above. 3: 750 permissions for everything chmod -R 750 /var/www/my-website.com/ The third command sets the permissions: read, write and execute (7) for the owner (i.e. you), read and execute (5) for the group owner (i.e. the web server), zero permissions at all (0) for others. Once again this is done on every file and folder in the directory, recursively. 4: new files and folders inherit group ownership from the parent folder chmod g+s /var/www/my-website.com/ The last command makes all files/folders created within the directory to automatically take on the group ownership of the parent folder, that is your web server. The s flags is a special mode that represents the setuid/setgid. In simple words, new files and directories created by the web server will have the same group ownership of my-website.com/ folder, which we set to www-data with the second command. When the web server needs to write If you have folders that need to be writable by the web server, you can just modify the permission values for the group owner so that www-data has write access. Run this command on each writable folder: chmod g+w /var/www/my-website.com/ For security reasons apply this only where necessary and not on the whole website directory. +-----+ https://www.digitalocean.com/community/questions/proper-permissions-for-web-server-s-directory Proper permissions for web server's directory Posted September 15, 2014 I have a doubt that I think is very basic but to which strangely I couldn’t find a concrete answer no matter how much I’ve googled for it. When configuring a web server (Nginx, in my case), most people recommend setting the permissions as follows: Create a new user other than root, and add it to the www-data group. Set the ownership of /var/www to the www-data user and www-data group. Directories 755 Files 644 This means that: The user owner of the directory (www-data) can read, write and execute. The assigned group (www-data, where my user is) can read and execute, but not write. Everyone else can read and execute, but not write. The problem with this is that, if the permissions are set in this way, I can’t edit files from the FTP because my user doesn’t have write permissions; this would require allowing the group to write adjusting the permissions like this: Directories 775 Files 664 However, I don’t know if this could be a security issue, or why do people recommend doing it the other way if it doesn’t work through FTP. So, what is the most appropriate way to set permissions for the server directory? +--+ blocksss June 27, 2016 So I’ve been thinking a lot about this lately, and something occurs to me. There will only ever be one web server, but there could be multiple developers working on a website. So instead of assigning the group to www-data, assign the user to www-data, and create a group dev-websitename and assign your development users to it. Then you can easily give more permissions to the dev group, and restrict permissions to the owner. I don’t see why “Other” users ever need any access what so ever. Here’s the code: sudo chown -R www-data:dev-mysitenamehere . sudo find . -type f -exec chmod 0460 {} \; sudo find . -type d -exec chmod 2570 {} \; The 2 in the directory chmod makes it so files inherit the folder’s group Now, the issue here is when you create new files as your user, their owner will be your user name, not the server’s name (www-data). But in some ways, this is ideal, forcing you to manually change the ownership of new files so that they are visible by the server. Of course you could always set git post.receive to do this for you too. For “storage” folders or other folders the server needs access to you can use this mode so your server can also edit these files: sudo find storage -type f -exec chmod 0660 {} \; sudo find storage -type d -exec chmod 2770 {} \; I have not sufficiently tested this method - it may be that there are downsides, but it just seems like it makes more sense to me. There will only be one server user, but there will be multiple developer users. So group makes sense for developers, while owner makes sense for the server, and other users have no business here. **************************** #] 24Dec2017 $ sudo chmod -R ug-w "/media/bill/RaspPi_ext4_32Gb/ToDos" **************************** #] 22Dec2017 man chmod target users (u) the user who owns it (g) other users in the file's group (o) other users not in the file's group (o) (a) all users permissions (r) read (w) write (x) execute (or search for directories) (X) execute/search only if the file is a directory or already has execute permission for some user (s) set user or group ID on execution (t) restricted deletion flag or sticky bit Instead of one or more of these letters, you can specify exactly one of the letters ugo: $ sudo chmod u-w "/media/bill/HOWELL_BASE/Neural Nets/My Reviews/00_Paper review form.odt" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" $ sudo chmod -R ug-w "/media/bill/HOWELL_BASE/Projects/Lucas - Universal Force" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" >> no workee??? https://askubuntu.com/questions/342791/file-permissions-wont-change File permissions won't change Solved! The answer was found here. gksu gedit /etc/fstab Add the next line as (if you don't know your UUID do a sudo blkid) UUID=12102C02102CEB83 /media/Store ntfs-3g auto,users,permissions 0 0 Save it and close the file. If you need to make the directory, which I did sudo mkdir /media/Store Then sudo mount /media/Store Finally (whatever permissions you want to set) chmod 755 -R /media/Store And then make it your own chown -R /media/Store Yeah, that took me like 8-10 hours over 2 days to get. And "Store" is for "Storage" :-P edited Apr 13 at 12:25, Community answered Sep 9 '13 at 2:32, mvl1014 >> I tried : $ sudo blkid /dev/sda1: UUID="32d51560-aecb-48f6-b14a-adb297a0a984" TYPE="ext4" PARTUUID="5213caa8-01" /dev/sda2: UUID="165cb7f9-dc00-4f48-8b70-55b10ca5d4c7" TYPE="swap" PARTUUID="5213caa8-02" /dev/sda3: UUID="d4651fa9-d9e7-472f-a939-37159801244b" TYPE="ext4" PARTUUID="5213caa8-03" /dev/sdc1: LABEL="HOWELL_BASE" UUID="5A74BFD974BFB5DB" TYPE="ntfs" /dev/sdd1: LABEL="Lexar" UUID="7260-5B07" TYPE="vfat" PARTUUID="c3072e18-01" >> from "/home/bill/bin/Dell64 backup all.sh" HOWELL_BASE is 32d51560-aecb-48f6-b14a-adb297a0a984 $ sudo kwrite /etc/fstab >> current line is : UUID=32d51560-aecb-48f6-b14a-adb297a0a984 / ext4 rw,errors=remount-ro 0 1 >> I CAN'T change this, as it applies to the WHOLE DRIVE! I need to format a Howell_BASE drive (and backup drives!) in ext4!!!! 08********08 #] 01Dec2021 cannot access 'USB VIDEO' drive - why? gparted no help fat32 (microshit) doesn't do same access control if I remember correctly must do BOTH chown, chmod!! $ sudo chmod -R ug-w "/media/bill/USB_VIDEO" Otherso I pass the USB to shouldn't be able to copy? - fat32 fat chance? $ sudo chmod -R a-r "/media/bill/USB_VIDEO" 08********08 #] ?date subject? +-----+ https://unix.stackexchange.com/questions/285687/a-quicker-way-to-change-owner-group-recursively A quicker way to change owner/group recursively? [duplicate] Currently, when I want to change owner/group recursively, I do this: find . -type f -exec chown . {} \; find . -type d -exec chown . {} \; But that can take several minutes for each command. I heard that there was a way to do this so that it changes all the files at once (much faster), instead of one at a time, but I can't seem to find the info. Can that be done? edited May 26 '16 at 15:54 asked May 26 '16 at 14:22 danzo +--+ Use chown's recursive option: chown -R owner:group * .[^.]* Specifying both * and .[^.]* will match all the files and directories that find would. The recommended separator nowadays is : instead of .. (As pointed out by justins, using .* is unsafe since it can be expanded to include . and .., resulting in chown changing the ownership of the parent directory and all its subdirectories.) If you want to change the current directory's ownership too, this can be simplified to chown -R owner:group . edited Apr 13 '17 at 12:37 Community♦ answered May 26 '16 at 14:24 Stephen Kitt +--+ For commands like chown that have their own recursion it is fastest to use that option: chown -R owner:group * .[^.]* Warning! In some shells, the form chown -R owner:group * .* replaces owner in root directory / . Because .* means ../../../../root, ../bin ... etc. All paths. However, the most widely used shell, bash, doesn't apply . and .., expanding patterns. However it is useful to know that the main problem that slows down your use of find is that you invoke chmown on every single directory and file found. It is much quicker to use: find . -type f -exec chown : {} + find . -type d -exec chown : {} + as each time chown is called with as many parameters as fit on the commandline. That change works for other commands, that don't have a built-in recursion option like chown, as well. And it works (and improves speed) in situations where there is such a recursion option but you cannot use it (e.g. when using chmod, and you only want to change directories). edited May 12 '18 at 21:28 peterh answered May 26 '16 at 15:40 Anthon ************************** #] Dec2017? IMPORTANT! : Chown & chmod don't work well on Fat32 etc formated drives!!! man chown might have to use the numeric value associated with that user (see /etc/passwd for user IDs) bill_ID on Dell64 = 1000:www.BillHowell.ca -c, --changes like verbose but report only when a change is made -R, --recursive operate on files and directories recursively -v, --verbose output a diagnostic for every file processed $ sudo chown -R -v bill:bill "/media/bill/Midas" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" | grep "retained as bill:bill" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" $ sudo chown -R -c bill:bill "/media/bill/HOWELL_BASE" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" $ sudo chown -R -c bill:bill "/media/bill/HOWELL_BASE" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" man chmod target users (u) the user who owns it (g) other users in the file's group (o) other users not in the file's group (o) (a) all users permissions (r) read (w) write (x) execute (or search for directories) (X) execute/search only if the file is a directory or already has execute permission for some user (s) set user or group ID on execution (t) restricted deletion flag or sticky bit Instead of one or more of these letters, you can specify exactly one of the letters ugo: $ sudo chmod u-w "/media/bill/HOWELL_BASE/Neural Nets/My Reviews/00_Paper review form.odt" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" $ sudo chmod -R ug-w "/media/bill/HOWELL_BASE/Projects/Lucas - Universal Force" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" >> no workee??? https://askubuntu.com/questions/342791/file-permissions-wont-change File permissions won't change Solved! The answer was found here. gksu gedit /etc/fstab Add the next line as (if you don't know your UUID do a sudo blkid) UUID=12102C02102CEB83 /media/Store ntfs-3g auto,users,permissions 0 0 Save it and close the file. If you need to make the directory, which I did sudo mkdir /media/Store Then sudo mount /media/Store Finally (whatever permissions you want to set) chmod 755 -R /media/Store And then make it your own chown -R /media/Store Yeah, that took me like 8-10 hours over 2 days to get. And "Store" is for "Storage" :-P edited Apr 13 at 12:25, Community answered Sep 9 '13 at 2:32, mvl1014 >> I tried : $ sudo blkid /dev/sda1: UUID="32d51560-aecb-48f6-b14a-adb297a0a984" TYPE="ext4" PARTUUID="5213caa8-01" /dev/sda2: UUID="165cb7f9-dc00-4f48-8b70-55b10ca5d4c7" TYPE="swap" PARTUUID="5213caa8-02" /dev/sda3: UUID="d4651fa9-d9e7-472f-a939-37159801244b" TYPE="ext4" PARTUUID="5213caa8-03" /dev/sdc1: LABEL="HOWELL_BASE" UUID="5A74BFD974BFB5DB" TYPE="ntfs" /dev/sdd1: LABEL="Lexar" UUID="7260-5B07" TYPE="vfat" PARTUUID="c3072e18-01" >> from "/home/bill/bin/Dell64 backup all.sh" HOWELL_BASE is 32d51560-aecb-48f6-b14a-adb297a0a984 $ sudo kwrite /etc/fstab >> current line is : UUID=32d51560-aecb-48f6-b14a-adb297a0a984 / ext4 rw,errors=remount-ro 0 1 >> I CAN'T change this, as it applies to the WHOLE DRIVE! I need to format a Howell_BASE drive (and backup drives!) in ext4!!!! ************************ #] 22Nov2017 couldn't set "read-only for "/media/bill/HOWELL_BASE/Neural Nets/My Reviews/00_Paper review form.odt" owner is bill - www.BillHowell.ca nemo - no workee chown - no workee : $ sudo chown -R -c bill:bill "/media/bill/HOWELL_BASE" 2>"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stderr.txt" >"/media/bill/HOWELL_BASE/System_maintenance/Linux/chown stdout.txt" Maybe just copy to start with fresh file? >> no workee ???????????????? I give up for now ... # enddoc