Rc.local specify user to run program

Source: Internet
Author: User

The CentOS 6.5 test found that sudo is not available in rc.local and can be used with the SU

However, there is a precondition that the specified user can not set up a home directory, but must be able to log in

[Email protected] ~]# vim/etc/rc.local

#!/bin/sh

#

# This script is executed *after* all and the other init scripts.

# can put your own initialization stuff in here if you don ' t

# want to does the full Sys V style init stuff.


/bin/su-svn-c "Svnserve-d-r/application/svndata/"


After reboot

[Email protected] ~]# Ps-ef|grep SVN

SVN 1561 1 0 11:52? 00:00:00 svnserve-d-r/application/svndata/

Root 1603 1583 0 11:53 pts/0 00:00:00 grep svn


Some users of the notes are used in Su <user> this form (less a-number), in fact, can also be started, but whether the use of-number or some areas

No-No.

[[email protected] ~]# su svn

[[email protected] root]$ echo $PATH

/application/mysql/bin:/application/mysql/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/ Bin:/usr/sbin:/usr/bin:/root/bin


Band-No.

[Email protected] ~]# SU-SVN

[Email protected] ~]$ echo $PATH

/application/mysql/bin:/application/mysql/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/ Local/sbin:/usr/sbin:/sbin:/home/svn/bin


Path paths are different, and only a minus sign is a complete switch identity.

Rc.local specify user to run program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.