LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This 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


Reply
  Search this Thread
Old 04-13-2012, 03:37 PM   #1
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Rep: Reputation: Disabled
-bash: syntax error near unexpected token `newline'


I wrote;

1): $ sudo chmod +a “group:staff deny execute” <program name>

(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:

2): $ sudo chmod +a# 0 “group:admin allow execute” <program name>

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

Thank you for every help

melensa
 
Old 04-13-2012, 05:46 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.


Cheers,
Tink
 
Old 04-13-2012, 07:44 PM   #3
yoK0
LQ Newbie
 
Registered: Apr 2012
Distribution: Slackware, CentOS
Posts: 29

Rep: Reputation: 0
Indeed, wierd. Im also suprised that chmod +a worked. Even tried it myself
and didnt work.

man chmod will solve your problem.

r -read
w -write
x - execute

chmod +x <file> will grant executable permission to everyone.
 
Old 04-14-2012, 07:58 AM   #4
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-14-2012, 08:37 AM   #5
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
Linux is not Apple (fortunatelly...)
man setuid
 
Old 04-14-2012, 11:14 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Moved: This thread is more suitable in Other *nix and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 04-14-2012, 01:21 PM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.

Code:
$ sudo chmod +a# 0 “group:admin allow execute” <program name>
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.
 
Old 04-14-2012, 03:16 PM   #8
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Original Poster
Rep: Reputation: Disabled
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?
 
Old 04-14-2012, 03:51 PM   #9
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Original Poster
Rep: Reputation: Disabled
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.

Thank you and greetings.
 
Old 04-14-2012, 04:07 PM   #10
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Original Poster
Rep: Reputation: Disabled
I tried
$ sudo chmod +a# 0 "group:admin allow execute" <program name>

but the answer was still

-bash: syntax error near unexpected token `newline'
 
Old 04-14-2012, 08:52 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You still haven't escaped the hash ... try that, see what it does.
 
Old 04-15-2012, 03:25 AM   #12
Melensa
LQ Newbie
 
Registered: Apr 2012
Location: Berlin
Posts: 8

Original Poster
Rep: Reputation: Disabled
I just tried

$ sudo chmod +a 0 "group:admin allow execute" <program name>

...same answer :-(
 
Old 04-15-2012, 01:51 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And the next question .. are you entering <program name> literally?
 
  


Reply



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
bash: syntax error near unexpected token `newline' beihaghian Linux - Newbie 5 12-15-2011 09:33 AM
syntax error near unexpected token 'newline' yusvian Linux - Newbie 6 11-23-2011 06:56 PM
[SOLVED] Syntax erroronear unexpected token `newline' noeleo Linux - Software 3 11-11-2011 04:40 PM
syntax error near unexpected token `newline' rcmonroig Linux - Software 2 07-22-2011 12:43 AM
syntax error near unexpected token `newline' uhollins Linux - Newbie 6 12-04-2008 01:18 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 04:59 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
Open Source Consulting | Domain Registration