Hello Jay,
Am 25.02.2020 um 17:56 schrieb Jay Vaughn <jeffersonvaughn@xxxxxxxxx>:
ok well to avoid this altogether I really need to just chmod on a base
directory and then all the branch directories and files.
would that be safer?
It depends. Since 755 is "safe", because user, group and everyone else gets at least read and execute rights, I suspect your problem somewhere else. Therefore my questions.
say i'd like to change /home/jvaughn/.ssh/*.* to 755 in one command and then
change /home/jvaughn/.ssh/*.* back to 600 in a subsequent command..
is there syntax that can accomplish that?
Yes. You found out, as I see.
Btw., only the private key files need to be 600, everything else can stay 644. 600 is necessary to make ssh happy. On Unix/Linux, Home directories usually are mode 700, so there's no way to get beyond that barrier without switching to a different user profile while the process already runs.
found it
/find /home/jvaughn/.ssh -type f -exec chmod 755 {} \;
for files.. do the same with <d> for dirs...
Yes, that's one way to achieve it (but without the leading / before find).
Since we're talking about ~/.ssh, this is usually just one level deep. So, the most easy way would be:
cd /home/jvaughn/.ssh
chmod 600 *
chmod 755 .
The most important thing to realize is that for every *found* file, find spawns a separate instance of chmod, which does it's job in some miliseconds and exits. Then, find continues. This is not a big deal for ~/.ssh, but when running this to straight out a huge directory tree with thousands of files/directories, the impact is considerable.
Doing this in V4R5 yields a job log in an OUTQ. For every single spawn of chmod. I don't know if shell child job logs are just deleted (if no error) in more recent incarnations of OS/400, or if they're not even created in the first place. So, even on a relative modern platform, find -exec could be resource hog par excellence. :-)
Btw., if anyone knows how to suppress job logs from QSH and child processes in V4, I'd be interested in a working solution. The stuff which is usually be found in the net about setting an ENVVAR doesn't work for me.
:wq! PoC
PGP-Key: DDD3 4ABF 6413 38DE -
https://www.pocnet.net/poc-key.asc
As an Amazon Associate we earn from qualifying purchases.