LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-27-2015, 09:22 AM   #1
jim.thornton
Member
 
Registered: May 2007
Posts: 404

Rep: Reputation: 19
Need help running scripts as a user and with permissions


I've installed an app that runs as a Daemon and continually monitors directories and manipulates file names. The problem is that when it is creating new files it is creating them with the ownership root which is then inaccessible to my other users. I then created a chmod and chown command to change the permissions on the directories/files. The problem is that this seems extremely inefficient to me. It also breaks the automation of the app which then requires me to manually click on the changes.

I created a special no-login user for this app.
I installed the app into that new user's profile (using root because it was a no-login user)
I created an init.d script so that it runs on reboot (using root because it was a no-login user)

The script is always running, but I'm assuming because I put it in the init.d of root that is why it is running as root.

I need help with the following:
1. How can I setup an init.d script to run as the user I installed to?
2. How can I setup my permissions so that my normal user "myname" can access those files that are created?
 
Old 09-27-2015, 09:27 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,686
Blog Entries: 23

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
How can I setup an init.d script to run as the user I installed to?
Not at all, that is a system script, needs (AFAIK) to be run as root...
Quote:
How can I setup my permissions so that my normal user "myname" can access those files that are created?
add the user to the group that is allowed to do that...
 
Old 09-27-2015, 10:33 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
The first answer here https://serverfault.com/questions/35...-nologin-shell seems to work.
If you want to start it from init.d I guess you'd make it
Code:
nohup <cmds> &
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
anacron, run as user, not running scripts. Permissions problem? quixote9 Linux - Software 1 04-23-2012 01:07 PM
Running Scripts When a User Logs Off in Run Level 4 Woodsman Slackware 11 01-05-2010 10:46 PM
Running Scripts at User Login? Setheck Linux - Software 6 09-27-2004 11:24 AM
running scripts as changed user rammya Linux - Software 2 04-08-2004 12:42 AM
[apache] running user scripts. yapp Linux - Software 0 10-03-2003 06:00 AM


All times are GMT -5. The time now is 09:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration