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.
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-03 02: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?
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2009-03-03 03:34
(Received via mailing list)
Start your rails server by other user.

On Tue, Mar 3, 2009 at 9:12 AM, Zhao Yi
<rails-mailing-list@andreas-s.net>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
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-03-03 03:47
(Received via mailing list)
On Mon, Mar 2, 2009 at 7:12 PM, Zhao Yi
<rails-mailing-list@andreas-s.net> 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 Donald
http://destiney.com/
This topic is locked and can not be replied to.