Erlang/OTP Forums

Author Message

<  Erlang  ~  Running a unix command in an erlang program

developer
Posted: Fri Aug 13, 2010 10:41 am Reply with quote
Joined: 03 Mar 2010 Posts: 6
Hi
Is there a way to run a command with root privileges in an Erlang program.. I know that os:cmd can run a unix command. But what if the command requires root privileges?

Thanks in advance
Developer
View user's profile Send private message
zajda
Posted: Sat Aug 14, 2010 9:14 am Reply with quote
User Joined: 22 Aug 2009 Posts: 83
maybe this thread will help you: http://forum.trapexit.org/viewtopic.php?p=55961&highlight=#55961

I would recommend following order of trying options from above link:

1. NIF
2. don't do it
3. old fd_ app
View user's profile Send private message
wojtnar
Posted: Wed Sep 01, 2010 9:54 am Reply with quote
Joined: 05 Feb 2010 Posts: 7
Why don't you use good old setuid root?
View user's profile Send private message
zajda
Posted: Wed Sep 01, 2010 4:11 pm Reply with quote
User Joined: 22 Aug 2009 Posts: 83
this is what NIF is supposed to do;)
View user's profile Send private message
wojtnar
Posted: Thu Sep 02, 2010 2:25 pm Reply with quote
Joined: 05 Feb 2010 Posts: 7
I didn't know about setcap. If available, is the way to go.

NIF won't let you escalate privs if already not root. Fortunately.
View user's profile Send private message
zajda
Posted: Sat Sep 11, 2010 10:31 pm Reply with quote
User Joined: 22 Aug 2009 Posts: 83
I just run into quite long blog post about escalating privileges in Erlang:

http://blog.listincomprehension.com/2010/01/sockets-with-privileges-or-avoiding.html

But, I would still recommend some work around with i.e. iptables if possible (also mentioned in this article).
View user's profile Send private message
wojtnar
Posted: Tue Sep 14, 2010 9:23 pm Reply with quote
Joined: 05 Feb 2010 Posts: 7
zajda wrote:
I just run into quite long blog post about escalating privileges in Erlang:

http://blog.listincomprehension.com/2010/01/sockets-with-privileges-or-avoiding.html


"Privilege escalation" is using a "defect" (so-called "bug") to gain more privileges, than a given process should have.
View user's profile Send private message
zajda
Posted: Wed Sep 15, 2010 10:48 am Reply with quote
User Joined: 22 Aug 2009 Posts: 83
excuse my English then. I guess everyone reading this thread is aware, that we talk about controlled and secure way to run commands with root privileges.
View user's profile Send private message
jwatte
Posted: Fri Sep 24, 2010 6:02 pm Reply with quote
User Joined: 10 Feb 2010 Posts: 34
zajda wrote:
excuse my English then. I guess everyone reading this thread is aware, that we talk about controlled and secure way to run commands with root privileges.


The way that's done in UNIX is that your main process runs as root as well. There's no way to escalate your privilege (a la "sudo") programatically. The main other way of getting root for a sub-command is to mark the sub-command as setuid.

So far, I don't understand what your question has to do with Erlang in specific. How would you solve the same problem in C?
View user's profile Send private message
wuji
Posted: Sat Aug 11, 2012 2:21 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
than half a century, and a football team's worth of of Cheap Ralph Lauren Shirts of children and grandchildren."He died as he lived. He
hard until the end, stayed positive, thought only of others others replica Christian Louboutin others and constantly reminded everyone of how blessed his life
been. His ambitions were far reaching, but he never never discount designer *beep* never believed he had to leave this Happy Valley to
them. He was a man devoted to his family, family, [h4]designer replica *beep*[/h4] family, his university, his players and his community," Paterno's family
in a statement.While at Penn State's helm, Paterno, who was was [h2]replica designer bags for sale[/h2] was born in Brooklyn, N.Y., led the Nittany Lions to
undefeated seasons and two NCAA championships, had only five losing losing cheap Ralph Lauren Polo losing seasons, was inducted into the College Football Hall of
View user's profile Send private message
ysshoes
Posted: Sat Aug 11, 2012 2:25 am Reply with quote
Joined: 11 Aug 2012 Posts: 1
The brand of low-cost christian louboutin shoes footwear symbol style. All girls are yearning for this pair of christian louboutins discount shoes in red to take pleasure in fantastic feeling cheap christian louboutin shoes in your feet. It really is rather christian louboutin sneakers charming, exceptional, christian louboutin discount shoes style and exceptional.
View user's profile Send private message
dongdongwu
Posted: Thu Sep 20, 2012 5:34 am Reply with quote
User Joined: 19 Sep 2012 Posts: 236
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum