Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8784203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:01:37+00:00 2026-06-13T21:01:37+00:00

I was thinking about running commands at system start as a regular user. Currently,

  • 0

I was thinking about running commands at system start as a regular user. Currently, to do so, I use a syntax like this:

su -c 'command with some arguments' user

But I was thinking that it might be beneficial to have a per-user rc.local file at ~/.rc.local that would automatically get run as the user at startup. The code I came up for it is like this:

awk -F":" '{ if ($3 >= 1000) print $1, $6 }' /etc/passwd | while read u h
do 
  [ -x "$h/.rc.local" ] && su -c "cd $h; ./.rc.local" $u
done

This would be added to /etc/rc.local. It searches the home directory of every non-system user (i.e., a uid >= 1000), and if the file exists, and is executable, it cd’s to the users home directory and executes that script as the user.

To me, this seems to eliminate any source of security risk, since it would be executing the script as the user, rather than root, but I’ve recently been reminded of my lack of security knowledge, so I present this question: is this a bad idea?

Right now, I’d only be running this on my home computer, and my home computer only has one non-system user. A few years down the road, my daughter my get her own account on the computer, but besides that, it’s not like complete strangers will have access to this in any way.

So, is there any potential security hole that I’m overlooking? Also, is there a more elegant way to write that command?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:01:38+00:00Added an answer on June 13, 2026 at 9:01 pm

    This overlaps with the @reboot capability of per-user crontabs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently thinking about how to design a multithreading system in Java that
Im thinking about to use a DB for my logs instead of a normal
Been thinking about this for hours now. Im building a simple slideshow application, where
I'm thinking about SEDA. We design at the moment an application (which is running
My company is still running Snow Leopard and we're thinking about upgrading to Mountain
We have a continuous integration server running Hudson CI . I'm thinking about putting
I am thinking about some issues which may match the term software integration best.
I've been thinking about virtualizing part or all of my RoR development environment. This
This question got me thinking about the .NET equivalent. What value is there to
I'm thinking about writing a very simple paint program. I would like a more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.