Forum: Ruby on Rails How can I set Rails user name?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Zhao Y. (Guest)
on 2009-03-03 03:12
I use root to start the Rails server. So all the operations on this
server will be root permission. For example, create a file in the server
disk. How can I change a user?
Billy H. (Guest)
on 2009-03-03 04:34
(Received via mailing list)
Start your rails server by other user.

On Tue, Mar 3, 2009 at 9:12 AM, Zhao Yi
<removed_email_address@domain.invalid>wrote:

>
> I use root to start the Rails server. So all the operations on this
> server will be root permission. For example, create a file in the server
> disk. How can I change a user?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
Greg D. (Guest)
on 2009-03-03 04:47
(Received via mailing list)
On Mon, Mar 2, 2009 at 7:12 PM, Zhao Yi
<removed_email_address@domain.invalid> wrote:
>
> I use root to start the Rails server. So all the operations on this
> server will be root permission. For example, create a file in the server
> disk. How can I change a user?

Perhaps something like this:

#!/bin/sh

cd /path/to/rails

if [ `/usr/bin/whoami` = 'root' ]; then
    /bin/su -c "/usr/local/bin/mongrel_rails start -e production -p
6001 -d" rails_user
else
    /usr/local/bin/mongrel_rails start -e production -p 6001 -d
fi



--
Greg D.
http://destiney.com/
This topic is locked and can not be replied to.