DaemonForums  

Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 29th June 2011
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default Running a command as a different user w/o starting the login shell

Is there a straightforward manner?

I know about su -c user, but that will try to start the login shell. If the login shell is set to /sbin/nologin (As it often is for cron/daemon users) it won't work.

I actually solved this problem already using a very simple C program using setgid(), setuid(), and system(). But I find it hard to believe that I'm the first one with this issue and that this is the easiest way ...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
 

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP client allows shell command injection J65nko News 0 7th April 2011 01:09 AM
Running a command with input from a file. bigb89 Programming 4 21st January 2009 06:36 PM
Execute a command during login rex FreeBSD General 4 12th September 2008 08:09 PM
command launched by normal user... maurobottone OpenBSD General 4 1st June 2008 03:45 AM


All times are GMT. The time now is 08:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick