
Originally Posted by
Bugbyte
Currently I can log in as root from some machines in my house but not from others, which is really weird because I never had that problem before. In fact, it is the opposite of the problem I posted about earlier where I could log in as root from everywhere but not as bugbyte without the server closing the connection.
Hey BugByte, not sure if you're still having problems with this, but I have a few suggestions for you, since you're using Ubuntu, or some derivative of it.
Generally by default, most SSH installs block root from logging in, since it's a huge security risk, plus Ubuntu actually generates a random password for the root user, and without setting it yourself (which I'm guessing you've done), you wouldn't be able to login anyways. I'm guessing the reason you can only access some of your machines as root is because this setting has been changed on a few of them, but not all of them.
There's a couple methods of getting a root shell, or at least root permissions, with an admin user account on Ubuntu:
1) sudo - From a regular user prompt, you can type 'sudo <command>' to run a command as another user. It basically stands for switch user and do command. By default, if you don't specify the user to run the command as, it will be run as root. It'll ask you for your password (to prove it's actually you sitting at the computer, and not someone who just walked up), and then execute the command.
2) sudo -i - Adding the -i flag, which is short for --interactive, spawns a new shell as the root user. Unfortunately, this changes the directory you're currently in to that users home directory, which can sometimes be a pain.
3) sudo su - This one is actually a derivative of #1. Basically you're sudoing the su command, which stands for switch user. By default, if you don't specify the user you want to switch to, you get the root user. The nice thing about this one is that it will use your same shell process, so you'll remain in the directory you were already in.
There are only a couple reasons I can think of to not run everything as root in home environment (where security isn't really essential).
a) so you don't accidentally screw something up when you rm a file or the like.
b) when you create files as root, the default owner/group is set to the root user/group, so you wouldn't be able to access the file as your regular user account without fixing the permissions.
So it's not a huge issue to run things as the root user all the time, as long as you're somewhat careful with the commands you're running.
If you're still having other issues with your setup, give me a shout, but I have a few suggestions below.
Also, just wondering, but is there a chance you're confusing /home/bugbyte/var/www and /bugbyte/var/www ? I'm guessing not, but you never know.
Suggestions:
Apache is generally installed with permissions for the www-data user on Ubuntu (you can check this in the /etc/apache2/envvars file).
Here's a few things you can try, if the user is www-data (and change www-data to the appropriate user/group for your system if not):
The following command will set the owner user/group to www-data for your directory:
Code:
$ sudo chown -R www-data:www-data /bugbyte/var/www
The next command, is the one that I think might actually fix your issue. This command basically gives read/listing access to everyone to your directory. This may be a security issue if other people who have access to the computer shouldn't be viewing what's in this directory (I would recommend making sure the permissions on those files are secure).
Code:
$ sudo chmod a+r /bugbyte
$ sudo chmod a+r /bugbyte/var
$ sudo chmod a+r /bugbyte/var/www
If that doesn't fix it, well, this should fix the permissions of all the files in the directory:
The following commands are a little more complicated, they go to your root website directory, and then find all the directories (-type d), and files (-type f), and execute a command on each file. The commands change the permissions for each item.
chmod 775 sets read/write/execute permissions for owners, and groups, and read/execute permissions for everyone else on the directory.
chmod 664 sets read/write permissions for owners and groups, and
Code:
~ $ cd /bugbyte/var/www
www $ sudo find . -type d -exec chmod 775 {} \;
www $ sudo find . -type f -exec chmod 664 {} \;
Again, if you are still having issues let me know, but this thread hasn't been updated in a month or two now, so you might be okay.
Bookmarks