Welcome, Guest. Please Login
 
  HomeHelpSearchLogin FAQ Radified Ghost.Classic Ghost.New Bootable CD Blog  
 
Pages: 1 2 
Send Topic Print
Magoo - Unix file transfer server-to-server (Read 15433 times)
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #15 - Dec 27th, 2010 at 12:39am
 
error:

Quote:
find: missing argument to '-exec'
 
WWW  
IP Logged
 

MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #16 - Dec 27th, 2010 at 3:00pm
 
Rad wrote on Dec 27th, 2010 at 12:39am:
find: missing argument to '-exec' 

Sounds like your shell is using the strict version of find.  Try:

find ./ -type d -exec chmod 755 {} \;

The {} gets replaced the name of each file that was found.  The ; tells find where the end of the exec command is.  The \ escapes the ; so the shell passes it into the command instead of interpreting it itself.

As always, the man page can be your friend here.

Rad wrote on Dec 27th, 2010 at 12:21am:
Why error for setting perms HIGHER than necessary?

For security reasons, some programs will refuse to operate on files with too permissive permissions.  This is especially true with critical security files such as the ssh authorized_keys file.

Rad wrote on Dec 27th, 2010 at 12:35am:
oops,almost forgot to cd to modx directory first.
what would happen if i did?

Yes, every file (or directory, depending on which command you ran) on the whole server would have its permissions changed.  You'd have errors all over the place afterward and there's no easy way to undo it.
 
WWW  
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #17 - Dec 27th, 2010 at 7:41pm
 
my tech sppt guy says:

chmod -R 755 /home/user/public_html/absolute/path/modx

will do this. but how does it discrimnate between directories and files like yours does?

i would feel uncomfortable running that command.

MrMagoo wrote on Dec 27th, 2010 at 3:00pm:
Yes, every file (or directory, depending on which command you ran) on the whole server would have its permissions changed.You'd have errors all over the place afterward and there's no easy way to undo it.

that's what i was worried about. the lesson there is > with great power (the shell) comes great responsiblity. i was always on high-alert using the shell. now i'm getting more comfortable > not so careful. i was getting tired, too.

red flag.

what do you know about Apache suEXEC? I am running that, I see. Is that good? Is that a default setting? Can't recall if I ever had that set/enabled.
 
WWW  
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #18 - Dec 28th, 2010 at 12:22am
 
find: type: No such file or directory
find: d: No such fle or directory
 
WWW  
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #19 - Dec 28th, 2010 at 6:10pm
 
Rad wrote on Dec 27th, 2010 at 7:41pm:
chmod -R 755 /home/user/public_html/absolute/path/modx
will do this. but how does it discrimnate between directories and files like yours does?


It doesn't.

Rad wrote on Dec 27th, 2010 at 7:41pm:
that's what i was worried about. the lesson there is > with great power (the shell) comes great responsiblity.

Yes, the shell has enough power to break things pretty quickly.  One thing that would make the command safer is to replace the "./" in the command with "/home/user/public_html/absolute/path/modx" or whatever the path is to the top level modx directory.  That way, you could run the command from anywhere and it would only run on that directory and sub-directories.

Rad wrote on Dec 28th, 2010 at 12:22am:
find: type: No such file or directory
find: d: No such fle or directory


Sounds like you forgot the "-" in front of type.  Try copying my command above and pasting it into your shell.  I copied and pasted the command into my own server and it worked fine.
 
WWW  
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #20 - Dec 28th, 2010 at 6:16pm
 
Rad wrote on Dec 27th, 2010 at 7:41pm:
what do you know about Apache suEXEC? I am running that, I see. Is that good?

It's good for what it is designed for, which is to allow a CGI script to run under a different user and group than apache itself is running under. 

http://httpd.apache.org/docs/1.3/suexec.html

Rad wrote on Dec 27th, 2010 at 7:41pm:
Is that a default setting?

No, probably not.  If it is set up improperly, it can open some pretty big security holes.
 
WWW  
IP Logged
 

Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #21 - Dec 28th, 2010 at 10:02pm
 
nice catch / deduction on the dash before 'type'.

sorry 'bout that. funny, cuz i asked that exact question back in my reply #11.

yes, it worked, tho at first it appeared the FILE chmod didn't work .. until i refreshed the page. then all permissions were there as expected. whew.

it's really a beautiful thing when you know how to work the shell mojo. mojo is the name for the shell's power.

and .. modx revo installed .. slicker than you can say whale snot.

beautiful. not a single error.

thank-you, much.

as a little side-note, v5.8.8 is the most recent version of perl supported by cPanel, whereas v5.12.2 is the most recent version of perl. my host advised against upgrading past what cPanel supports.
 
WWW  
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #22 - Dec 30th, 2010 at 1:13pm
 
in reflecting, the only thing i dont get is how your scripts work recursively without the -r
 
WWW  
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #23 - Jan 2nd, 2011 at 2:24pm
 
Rad wrote on Dec 30th, 2010 at 1:13pm:
in reflecting, the only thing i dont get is how your scripts work recursively without the -r 


In strictly technical terms, they aren't scripts.  'find' is a single command.  Everything else was parameters to the find command.  A script is a series of commands.  We just ran 'find' twice.

It works without the '-r' because find searches for files recursively by default, as opposed to many commands that only work on the current directory by default.  There are options we can pass the 'find' command to limit its recursive search to a set number of levels deep or to make it not follow symbolic links or to keep it from jumping file systems.  It's a very flexible command.  Check out the man page if you're interested.
 
WWW  
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #24 - Jan 4th, 2011 at 6:19pm
 
MrMagoo wrote on Jan 2nd, 2011 at 2:24pm:
In strictly technical terms, they aren't scripts.

Thanks. It's important to me I learn the lingo, correctly, cuz that indicates comprehension. I never heard anyone address the difference, but, to me, I just kinda considered a script as "a long string of geeky-characters we pass to the server" .. and a command was just a command. e.g. cp yada yada file.extension

But aren't we combining find with chmod? That's a different unix command, right?
 
WWW  
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #25 - Jan 5th, 2011 at 12:34am
 
Rad wrote on Jan 4th, 2011 at 6:19pm:
But aren't we combining find with chmod? That's a different unix command, right? 

chmod is the input for the '-exec' flag.  We're telling find to execute chmod 755 etc on every file it finds.  It's all one beautiful instruction. 

A script is usually several instructions saved in a text file and executed as a set.  Even a very long, complex command involving a few pipes isn't considered a script by most admins.  You have to do several commands in series, each relying on the results of the previous command, to make a script worth sharing.  One command, no matter how many things we pipe it to or how many arguments we pass it, isn't really a script.

This isn't entirely a bad thing.  If you can get something done in one command, you are doing it better than someone who writes a whole 10 line script to accomplish the same thing.
 
WWW  
IP Logged
 

Rad.Test
Technoluster
***
Offline


Rad's non-Admin test-profile
in Firefox

Posts: 108


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #26 - Jan 5th, 2011 at 1:29am
 
MrMagoo wrote on Jan 5th, 2011 at 12:34am:
It's all one beautiful instruction.

got that right.  Smiley

MrMagoo wrote on Jan 5th, 2011 at 12:34am:
Even a very long, complex command involving a few pipes isn't considered a script by most admins.

i learned something today.
 
 
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Magoo - Unix file transfer server-to-server
Reply #27 - Jan 6th, 2011 at 2:59am
 
MrMagoo wrote on Jan 5th, 2011 at 12:34am:
A script is usually several instructions saved in a text file and executed as a set.

I wanted to expand on this because I'm not satisfied with my explanation.  I think it'll be clearer if I describe it this way:

Scripting is a lighter form of programing.  A script won't be a full program in that it probably won't have classes and objects and probably won't do very sophisticated error handling.  It should be like a program in that it uses some logic to step through the automation of a task.  So scripting is really a half-way step between single commands and full programs.

Also, I finally got my 1,000th post in.  Grin
I lurked for quite a while starting in probably early 2002 and then finally made myself a user name in 2005 after I posted my first guide.  Radified was one of a handful of sites I ran across while I was trying to get my tech wings underneath me, and I'm proud to be here giving back now.  Thanks to Rad for putting together such a great site and to all of your members for keeping it always interesting and enlightening.
 
WWW  
IP Logged
 
Pages: 1 2 
Send Topic Print