I have two servers svrA and svrB (both CentOS 7), where svrA is a turn-key system so I cannot change anything on it, and svrB is the one I am working on. svrA contains log files I need to transfer to svrB. svrA provides these via a read-only NFS mount, with the following /etc/exports:

/opt/logfiles *(ro,no_root_squash,insecure)

These logfiles have all kinds of permissions, some can only be read by root - and this is the problem.

On my svrB, I have a log transfer script that mounts the NFS share and copies the files from svrA to svrB. For security reasons, I don't want that script to run as root on svrB, it has a dedicated user instead. But this means I cannot access some files on the NFS share of svrA!

Is there any way I can mount the svrA NFS share from svrB "with root permissions", so I can read "mode 600, owner root" files from svrA, without having to

  • become root on svrB, or
  • change anything on svrA?

I know that on OpenVMS, the NFS client can specify a UID/GID via a proxy. But is it possible with CentOS 7?

  • why not log in as root on srvB and just read the logs as root from there, or use sudo to read them? – Bart Jul 16 at 14:35
  • Good suggestion - I forgot to mention it, but srvB has ONLY NFS access to svrA. No interactive or scripted login possible. But that would have been a good solution. – garreth33 Jul 17 at 9:17
  • Perhaps you could run a separate program as root on svrB that copies the root/600 logfiles from svrA into a directory tree on svrB with the file ownership changed to the UID of the backup-script user, and change the script to collect those files alongside the ones it is able to collect directly from svrA. – ottomeister Jul 17 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.