D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Changing User ID.

 

On 03/05/17 01:26, mr meowski wrote:
On 02/05/17 23:22, M. J. Everitt wrote:
On 02/05/17 22:48, Julian Hall wrote:
Cerce Books # cd Mine/Just\ Ordinary\ Men/Main\ Story/
Cerce Main Story # ls -alh DOC
total 2.7M
drwxr-xr-x 2 julian julian 4.0K May  2 14:48 .
drwxr-xr-x 5 julian julian 4.0K Jan 19 17:56 ..
-rwxrwxrwx 1   1026 users   51K Sep 21  2012 Ordinary Men_ch10.doc
-rwxrwxrwx 1   1026 users   48K Sep 22  2012 Ordinary Men_ch11.doc
-rwxrwxrwx 1   1026 users   51K Sep 21  2012 Ordinary Men_ch12.doc
<snip snip>

Yeah .. those '1026' and '1024' ids should really be 'julian' I fear,
and I suspect there is some peculiarity going on with the NFS share.

Mr meowski was hoping you could change permissions with your user id,
and perhaps with sudo this /may/ have been possible, but as you've
proven, this is a whole lot more reliable as root, and therefore you
need to be more careful what you specify in the 'chown' command as your
user/group (NB. iirc, both are not always necessary). $USER in this
instance has shlurped 'root' instead of 'julian' as desired... !

I think you've got a lot of options in your NFS mount in /etc/fstab .. I
think I've managed with a very minimal config in the past to the effect
of "nfsvers=3 (to prevent nfs4 chaos) and rsize/wsize=zzz to optimise
transfer sizes. no-auto seems unnecessary if you want to -use- the share
without manually mounting, and 'nouser' is supposed to prevent normal
users from mounting the share themselves, hence requiring root
privileges. Somewhere I think you have a stack of potentially
conflicting options .. you might want to pare down (either by starting
with few/no options, or by reducing down one-by-one) to see which change
helps/breaks your scenario. You may be super-unlucky in that some other
(udisks?) service is not overriding your fstab information which you
-think- is being used, and you should definitely check what options are
*active* when the NFS share is up (simply type 'mount' and look at the
NFS entry's options) might give you a hint as to where to look for the
problem.
Yes, this is all pretty much spot on - the NFS stuff is *definitely*
wrong as MJE points out: those "1026:users" entries are sure signs of
incorrect permissions. So for the moment, completely abandon the NFS
stuff: it's broken, full stop. I've already pointed out that fstab
stanza is a big fat mess with mutually contradictory options
specified... But one thing at a time, or we'll never fix anything.

Also correct: the chown command failed on the copy of "Main" folder in
your example, presumably due to permissions *again* which is odd 'cos I
thought you'd already chmod'd them 777 previously. You should have
reissued it with sudo instead of as root because then the $USER variable
would have been properly evaluated, but that was my fault for not being
clearer. So, when you get the chance grab a terminal and head back to
the same spot.

So, presuming that you are julian:julian (user:group), have sudo access
and are back in the arbitrary folder/path "Word" do the following:

sudo chmod -R 777 Main
sudo chown -R julian:julian Main
sudo cp -avr Main ~/Desktop/
cd ~/Desktop/Main
ls -alh

This is using brute force and is hardly elegant, but hey Â\_(ã)_/Â

It will set full permissions (read/write/execute) to ON for
user/group/others (so everyone basically), change the owner and group to
UID julian and GID julian (which should be completely redundant
following a 777 but whatever), recursively copy (with sudo, again
redundant) the entire Main folder whilst preserving all of it's
attributes to the Desktop and finally cd to it and dump out the listing
in long format. Paste the output of the final command - there won't be
any errors this time, and if there are, we have serious problems.

You should see all your files now owned by julian:julian and with
permissions rwxrwxrwx for all entries except directories which will be
drwxrwxrwx. Browse to it with a Nautilus/Thunar/whatever file viewer and
everything should look fine as well. More importantly, you should now
probably be able to open the files in LibreOffice writer and edit them
as usual.

I say "probably" because there are still things that may be preventing
this: the OpenOffice > LibreOffice switch, the presence of temporary or
stale lock files or a default save setting in OpenOffice that was
somehow exporting files in a protected mode. But at least the stale/temp
files thing will be immediately obvious from the output of the final "ls
-alh" and the other issues can be dealt with one at a time.

See how you get on with that for now.

Cheers
Many thanks Michael and mr meowski.

The copied folder now has this output for the outer Mine folder:

julian@Cerce /media/julian/HERA/Word $ cd ~/Desktop/Mine
julian@Cerce ~/Desktop/Mine $ ls -alh
total 40K
drwxrwxrwx 6 julian julian 4.0K Dec 30  2015 .
drwxr-xr-x 3 julian julian 4.0K May  3 17:25 ..
drwxrwxrwx 2 julian julian 4.0K Oct 16  2015 Cardassian Galaxy
drwxrwxrwx 2 julian julian 4.0K Apr 30 18:33 Harp And Dagger
drwxrwxrwx 5 julian julian 4.0K Jan 19 17:54 Just Ordinary Men
drwxrwxrwx 3 julian julian 4.0K Apr 22  2016 Misc
-rwxrwxrwx 1 julian julian  14K May  1  2014 Novel_Idea.doc

This is the output for the files inside the nested folders:

julian@Cerce ~/Desktop/Mine/Just Ordinary Men/Main Story/DOC $ ls -alh
total 2.7M
drwxrwxrwx 2 julian julian 4.0K May  2 14:48 .
drwxrwxrwx 5 julian julian 4.0K Jan 19 17:56 ..
-rwxrwxrwx 1 julian julian  51K Sep 21  2012 Ordinary Men_ch10.doc
-rwxrwxrwx 1 julian julian  48K Sep 22  2012 Ordinary Men_ch11.doc
-rwxrwxrwx 1 julian julian  51K Sep 21  2012 Ordinary Men_ch12.doc
-rwxrwxrwx 1 julian julian  47K Sep 21  2012 Ordinary Men_ch13.doc
-rwxrwxrwx 1 julian julian  50K Sep 21  2012 Ordinary Men_ch14.doc
-rwxrwxrwx 1 julian julian  49K Sep 22  2012 Ordinary Men_ch15.doc
-rwxrwxrwx 1 julian julian  50K Sep 22  2012 Ordinary Men_ch16.doc
-rwxrwxrwx 1 julian julian  52K Sep 21  2012 Ordinary Men_ch17.doc
-rwxrwxrwx 1 julian julian  55K Sep 22  2012 Ordinary Men_ch18.doc
-rwxrwxrwx 1 julian julian  46K Sep 22  2012 Ordinary Men_ch19.doc
-rwxrwxrwx 1 julian julian  44K Sep 21  2012 Ordinary Men_ch1.doc
-rwxrwxrwx 1 julian julian  42K Sep 22  2012 Ordinary Men_ch20.doc
-rwxrwxrwx 1 julian julian  53K Oct 22  2012 Ordinary Men_ch21.doc
-rwxrwxrwx 1 julian julian  48K Oct 30  2012 Ordinary Men_ch22.doc
-rwxrwxrwx 1 julian julian  51K Nov  7  2012 Ordinary Men_ch23.doc
-rwxrwxrwx 1 julian julian  46K Nov 17  2012 Ordinary Men_ch24.doc
-rwxrwxrwx 1 julian julian  50K Nov 19  2012 Ordinary Men_ch25.doc
-rwxrwxrwx 1 julian julian  50K Dec  1  2012 Ordinary Men_ch26.doc
-rwxrwxrwx 1 julian julian  39K Sep 21  2012 Ordinary Men_ch2.doc
-rwxrwxrwx 1 julian julian  45K Sep 21  2012 Ordinary Men_ch3.doc
-rwxrwxrwx 1 julian julian  43K Sep 21  2012 Ordinary Men_ch4.doc
-rwxrwxrwx 1 julian julian  47K Sep 21  2012 Ordinary Men_ch5.doc
-rwxrwxrwx 1 julian julian  46K Sep 21  2012 Ordinary Men_ch6.doc
-rwxrwxrwx 1 julian julian  44K Sep 21  2012 Ordinary Men_ch7.doc
-rwxrwxrwx 1 julian julian  41K Sep 21  2012 Ordinary Men_ch8.doc
-rwxrwxrwx 1 julian julian  40K Sep 21  2012 Ordinary Men_ch9.doc
-rwxrwxrwx 1 julian julian 430K Sep  7  2012 Ordinary Men.doc
-rwxrwxrwx 1 julian julian  24K Dec 30  2015 Ordinary Men_Epilogue.doc
-rwxrwxrwx 1 julian julian 923K Feb 17 17:43 Ordinary Men - Longer.doc
-rwxrwxrwx 1 julian julian  22K Dec 30  2015 Ordinary Men Prologue.doc

It seems they all have me as the owner and group!

Kind regards,

Julian

--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq