# Password protecting access to script/console?

**URL:** <https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236>\
**Category:** Rails\
**Created:** [March 9, 2007, 2:39am UTC](https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236 "2007-03-09T02:39:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [March 9, 2007, 2:39am UTC](https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236/1 "2007-03-09T02:39:49Z")

</div>

Sorry if this is asked and answered before, is there away to password  
protected access to script/console ?

I’ve seen a few posts on how to protect/encrypt the db passwords in  
database.yml, but that still leaves unprotected access to pretty much  
the same data via the console.

---

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [March 9, 2007, 3:21am UTC](https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236/2 "2007-03-09T03:21:50Z")

</div>

On Fri, 2007-03-09 at 02:39 +0100, Erik wrote:

> Sorry if this is asked and answered before, is there away to password  
> protected access to script/console ?
> 
> I’ve seen a few posts on how to protect/encrypt the db passwords in  
> database.yml, but that still leaves unprotected access to pretty much  
> the same data via the console.

* * *

I put the rails\_root directory in user space which would mean that you  
would have to log on as the user to access the console for a particular  
rails application.

Craig

---

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [March 9, 2007, 3:27am UTC](https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236/3 "2007-03-09T03:27:50Z")

</div>

Craig’s solution is best – you can’t really password protect script/  
console. Even if you restrict access there, you’ll need to worry  
about people who require your RAILS\_ROOT/config/environment.rb into  
their scripts because that’ll give them access to all your models from  
within their scripts.

If you really wanted to password protect the whole thing, you’ll need  
to setup some sort of scheme whereby your webserver passes in a key or  
something to your rails app on boot. This same key would need to be  
provided by script/console and whatever other scripts you have.

All-in-all a huge headache. I’d go with Craig’s solution.

---

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [March 9, 2007, 1:28pm UTC](https://www.ruby-forum.com/t/password-protecting-access-to-script-console/88236/4 "2007-03-09T13:28:10Z")

</div>

Eden Li wrote:

> Craig’s solution is best – you can’t really password protect script/  
> console. Even if you restrict access there, you’ll need to worry  
> about people who require your RAILS\_ROOT/config/environment.rb into  
> their scripts because that’ll give them access to all your models from  
> within their scripts.
> 
> All-in-all a huge headache. I’d go with Craig’s solution.

It is a bit of headache, thanks for your answers
