LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-06-2019, 11:27 PM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,645

Rep: Reputation: 278Reputation: 278Reputation: 278
Smile chmod reference perms


Hello guys, how do i copy the folder permissions from one serve to another server?

chmod -R --reference REMOTEFOLDER LOCALFOLDER

So basically, I need to SSH to the other server and execute this command.

But how to set the RemoteFolder?

I tried this doesn't seem to work:


ssh admin@192.168.11.55 'chmod -R --reference admin@192.168.11.55:/share/apps/ /share/apps'

Please help. Thanks,
 
Old 02-07-2019, 12:05 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,707

Rep: Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497
I'm pretty sure chmod is local-only cmd eg
Quote:
--reference=RFILE
use RFILE's mode instead of MODE values
from the Centos 7 chmod man page.
I' pretty sure that the 'R' in 'RFILE' stands for 'reference' not 'remote'...

Basically you'd have to get the values you want into a var and then pass that in to the ssh cmd.

If you are actually copying the file over and want to "preserve" at the other end, scp has a '-p' option
Quote:
-p Preserves modification times, access times, and modes from the original
file.
NB: lowercase 'p' there...
 
1 members found this post helpful.
Old 02-08-2019, 09:10 PM   #3
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,645

Original Poster
Rep: Reputation: 278Reputation: 278Reputation: 278
Hi Chris, I ended up recreating the permissions. Anyway only a few of them. Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 02:10 PM
CHMOD now perms for nothing duryodhan Slackware 7 10-18-2006 02:31 PM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 09:53 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 06:37 AM
chmod +s or chmod -s excel28 Linux - General 1 09-30-2003 04:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration