-bash: syntax error near unexpected token `newline'
Other *NIXThis forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
(All users on the system are in the “staff” group, so the
commands below should allow members of the admin group to execute <program name>,
but deny that right to members of the staff group:
With the first command I had no problem but when I wrote the second, it appeared:
-bash: syntax error near unexpected token `newline'
Does somebod have an idea of what is going on?...
I am desperate, I am afraid that the first command alone might have caused a damage to the rights of the admin / root account
First things first: what are you trying to achieve?
And is what you posted above what you literally typed?
If it is it's quite surprising that it worked, because
what I see there is not valid syntax for chmod in any
incarnation I've come across.
Thank you for your answer and forgive please my incompetence,I am a newcomer.
This is a quote from the Apple security configuration (you can download it from Apple)
" Using ACLs to Restrict Usage of Setuid Programs
The ACL feature of Mac OS X can also be used to restrict the execution of setuid
programs. Restricting the execution of setuid programs to administrators prevents
other users from executing those programs. It should also prevent attackers who are
currently running with ordinary user privileges from executing the setuid program and
trying to elevate their privileges. All users on the system are in the “staff” group, so the
commands below allow members of the admin group to execute <program name>,
but deny that right to members of the staff group:
$ sudo chmod +a “group:staff deny execute” <program name>
$ sudo chmod +a# 0 “group:admin allow execute” <program name> "
Only the first command
$ sudo chmod +a “group:staff deny execute” <program name>
has been accepted. The second
$ sudo chmod +a# 0 “group:admin allow execute” <program name>
has been refused with the answer:
-bash: syntax error near unexpected token `newline'.
What I want to achieve is restricting the execution of setuid programs to the admin account. The other accounts should not be able to do it.
Please use [code][/code] tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
You do realize that "#" is the character that starts a shell comment, right? So everything after it is invisible to the shell. If the # is intended to be passed to chmod, then it needs to be quoted or escaped first.
Also, do be aware that only ['] and ["] are correct quote characters. The fancy [”] quotes above are not proper shell syntax.
Thank you very much for the answer David. I am a totally newcomer so I don't know much at the moment.
Could you please tell me HOW I should write that command to tell Terminal that I want that only Admin can execute <program name>?
You also say that "The fancy [”] quotes above are not proper shell syntax": why the first command has been accepted? Or the fact that Terminal didn't react doesn't mean that it accepted it?
Perhaps my question was not so clear. I have a MacOsx 10.5.8 I have experienced some strange features (The mouse was moving by itself in more than a situation - I found an IMAP entrance in my email (gmail: details) with an unknown IP number - My desktop screen changed the image by itself and the new image was a strange one with many numbers and written Hash, plain and cracked - plus some more things happened,which made me arrive to the conclusion that it was time for me to improve the security of my computer. Therefore I downloaded the security configuration from Apple, from which I copied the command that doesn't work with the ["] and provokes the sintax error in Terminal.
The Apple security configuration for Leopard seems to have a tipping mistake. Could u please tell me what should I write instead?
I am a student and I have nothing important in my computer but I feel violated. it is a very bad feeling to have 'intruders' in a private sphere, it is a virtual stalking.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.