More geek-help needed

User avatar
xiamenese
Posts: 4767
Joined: Mon Jan 29, 2007 1:32 am
Platform: Mac
Location: London or Exeter, UK.

Thu Nov 26, 2009 7:19 am Post

Can one of you super-users please help me by writing a simple chmod or whatever command to run in terminal, to change the permissions on a whole bunch of files, please?

On both my computers I have an adminsitrator account and a regular user account, the latter being the one I use all the time. I have just discovered that, having installed the latest version of Bookends that was tweaked to work with Nisus Writer Pro, all the format files have their permissions set to the administrator account only being able to read and write ... the others are read only. This results in failure in scanning documents in Nisus to format the citations and produce the bibliography.

I can change them all manually to have read and write permissions, and have done so on the format file I'm using currently, but it's laborious, as I have to open the information on each one, open the permissions pane, click the padlock to open it by entering the administrator name and password and then change the permissions.

If I knew the syntax for a terminal command to take all the files in the appropriate folder ../Bookends 10/Formats/*.* and change their permissions to Read & Write for "admin user", "staff" and "everyone", that would save a lot of time and effort.

Thanks for your help. :)

Mark
The Scrivenato sometimes known as Mr X.
M1 MacBook Air (2021), 11.2.3, 16GB RAM, !TB SSID
iMac 27" (late 2015) 10.15.7, 24GB RAM, 512GB SSID
2017 iPad, iPadOS 14.4.1, 128GB, Apple Pencil
Scrivener, Scapple, Nisus Writer Pro, Bookends …

User avatar
Jaysen
Posts: 6309
Joined: Mon Dec 17, 2007 4:00 am
Platform: Mac + Windows
Location: East-Be-Jesus-Nowhere SC, USA

Thu Nov 26, 2009 2:09 pm Post

It might be easier to chown (change owner) all the files to the correct UID. Problem here is that you need to first make sure that you have the same UID on both systems. Before I tell you how to verify this let us assume that the user name is MrX.

On each system:

Code: Select all

id MrX

This will give you something like

Code: Select all

mac:~ jaysen$ id jaysen
uid=502(jaysen) gid=502(jaysen) groups=502(jaysen),98(_lpadmin),81(_appserveradm),79(_appserverusr),80(admin)
mac:~ jaysen$

The like you care about is the UID. If they are both the same then you can do something like

Code: Select all

find ~/Documents -name "*.nissus" -exec sudo chown MrX {} \;

That will find everything that has an extension .nissus (which is probably not correct but you get the idea) and will set to to be owned by MrX.

If that is NOT possible then you can change the find like above to be

Code: Select all

find ~/Documents -name "*.nissus" -exec sudo chmod go+rw {} \;


If you need more than that let me know.
Jaysen

I have a wife and 2 kids that I can only attribute to a wiggle, a giggle, and the realization that she was out of my league so I might as well be happy with her as a friend. 26 years marriage later, I can't imagine life without her. -Me 10/7/09

ImageImage

User avatar
xiamenese
Posts: 4767
Joined: Mon Jan 29, 2007 1:32 am
Platform: Mac
Location: London or Exeter, UK.

Fri Nov 27, 2009 2:49 am Post

Jaysen,

Thanks, as ever. Actually these files are not shared between the two machines, fortunately, as for totally stupid reasons my user names are not identical on each. But they are located in the Bookends application folder on each installation.

As it happens, I found I was running into a serious database problem on the MBA and the best solution was simply to remove the app and all its supporting files and do a complete re-install — the actual database of references is on DropBox so that was not affected — so I got round this permissions problem on that one by re-installing into the Applications folder within my user account, rather than the system applications folder. After all, I'm the only one using the MBA. All seems to be working well now. :)

As for the MBP, I'll look into your chowns. The files in question are all in a /Formats/ folder within the application folder; there's nothing else within that folder. They don't have a visible extension, but if I restrict it to that folder, presumably *.* will do the trick. One thing that I wonder is whether, having done that, next time repair permissions runs, it will set them all back to the original!

So, if I have any problems, I'll do on the MBP as I have done on the MBA, and simply put the whole app into my user account.

Thanks very much for your help.

Mark
The Scrivenato sometimes known as Mr X.
M1 MacBook Air (2021), 11.2.3, 16GB RAM, !TB SSID
iMac 27" (late 2015) 10.15.7, 24GB RAM, 512GB SSID
2017 iPad, iPadOS 14.4.1, 128GB, Apple Pencil
Scrivener, Scapple, Nisus Writer Pro, Bookends …

User avatar
Jaysen
Posts: 6309
Joined: Mon Dec 17, 2007 4:00 am
Platform: Mac + Windows
Location: East-Be-Jesus-Nowhere SC, USA

Fri Nov 27, 2009 3:49 am Post

Just make the find look like

Code: Select all

find /Applications/<xxx>/Formats/ -exec sudo chmod gw+rw {} \;

Replace <xxx> with the correct path inside the applications folder.

Repair perms should be OK, but you might want to leave yourself a note ;)

Let me know if you need anything else.
Jaysen

I have a wife and 2 kids that I can only attribute to a wiggle, a giggle, and the realization that she was out of my league so I might as well be happy with her as a friend. 26 years marriage later, I can't imagine life without her. -Me 10/7/09

ImageImage

ta
tammycravit
Posts: 20
Joined: Fri Oct 30, 2009 2:50 am
Platform: Mac
Location: Central Coast, CA
Contact:

Fri Nov 27, 2009 6:09 am Post

Jaysen wrote:Just make the find look like

Code: Select all

find /Applications/<xxx>/Formats/ -exec sudo chmod gw+rw {} \;



Another way to accomplish this, which I prefer because it's a bit more readable and avoids some of the odd punctuation required by the -exec option, is something like the following:

Code: Select all

find /Applications/<xxx>/Formats/ -print | xargs sudo chmod go+rw


-- Tammy
Tammy Cravit, novelist and photojournalist
"Abuse of Discretion", Tessa Riley #1 (11/2011): Kindle, Smashwords
"Manifest Error", Tessa Riley #2, coming in early 2012
http://www.tammycravit.com/

User avatar
Jaysen
Posts: 6309
Joined: Mon Dec 17, 2007 4:00 am
Platform: Mac + Windows
Location: East-Be-Jesus-Nowhere SC, USA

Fri Nov 27, 2009 1:22 pm Post

Being an "old" unix guy I remember when xargs wasn't always handling special characters properly. That and there is an efficiency gain by not spawning the extra processes needed. This is irrelevant in todays systems with fast processor and single users but some habits die hard.
Jaysen

I have a wife and 2 kids that I can only attribute to a wiggle, a giggle, and the realization that she was out of my league so I might as well be happy with her as a friend. 26 years marriage later, I can't imagine life without her. -Me 10/7/09

ImageImage

ta
tammycravit
Posts: 20
Joined: Fri Oct 30, 2009 2:50 am
Platform: Mac
Location: Central Coast, CA
Contact:

Fri Nov 27, 2009 4:21 pm Post

Jaysen wrote:Being an "old" unix guy I remember when xargs wasn't always handling special characters properly.


I remember those days, too. (I've been a "Unix gal" since the early 1990s). But the wonderful thing about Unix-based operating systems is that there's almost always more than one way to do things, and we can pick the one that makes the most sense to us.

-- Tammy
Tammy Cravit, novelist and photojournalist
"Abuse of Discretion", Tessa Riley #1 (11/2011): Kindle, Smashwords
"Manifest Error", Tessa Riley #2, coming in early 2012
http://www.tammycravit.com/