0

Based on a recommendation on stack overflow, i am giving yii framework a spin.

It appears that I am only able to gain shell access to my web server if I log in as root.

I am running through the tutorial, and am having a number of problems typical command to create a web app-

/usr/local/bin/php /home/testuser/public_html/yii/framework/yiic webapp /home/testuser/public_html/demo
  1. Do I have to type /usr/local/bin/php EVERY TIME???
  2. Do I have to type /home/testuser/public_html/yii/framework/yiic in full every time???
  3. Do I have to yype /home/testuser/public_html/demo in full?
  4. As I am logged in as ROOT, I have to chown every file / folder created by root to make the file viewable by testuser!!!
  5. I create a new controller using yii. controller message helloWorld, yii does some funky stuff, but I can't do ANYTHING with the files without chown EVERYTHING!!!

I'm not too confident with SSH, and I know it's all a learning curve, but... having to change file permissions EVERY time, and having to type full directories every time is just a pain.

I know that there are some shortcuts that I will probably learn with time, but if anybody could give me some pointers to make my life about 1M times easier (considering my main objectives at present are to learn yii framework) linux/terminal/shell commands are currently secondary to my requirements.

vasanth
  • 715
  • 10
  • 23
Gravy
  • 12,264
  • 26
  • 124
  • 193

1 Answers1

2

Here's what I'd do, in this order:

1 - When you login as root issue the command su - testuser. This changes your effective user id and groupid to that of testuser, meaning, you now are operating as that user account. Your current directory should now be the testuser's home directory. To get back to root user just type exit.

2 - Try running php -v without the fullpath. If it prints out a version number then you don't have to use the fullpath to run php. If you get an error then you can add /usr/local/bin to your PATH environment variable in your .profile file which is present in testuser's home directory. If the .profile doesn't exist then you can create it.

3 - Add /home/testuser/public_html/yii/framework to your PATH in testuser's .profile.

After doing all that then the next time you login as root you would be able to do the following:

su - testuser
cd public_html
php yiic webapp demo

And you wont have to worry about permissions since you are creating directories/files as testuser, not root.

See also: StackOverflow question about modifying your PATH

Community
  • 1
  • 1
j.w.r
  • 4,136
  • 2
  • 27
  • 29