XAMPP or any other service tool in /opt? Security - linux

I am developing with Xampp for Linux and Tomcat (similar to Xampp on Windows). Many programs like /IDEA, Tomcat and Xampp are recommended to be installed under /opt Now I have heard that it is not recommended to run services as root, but on Ubuntu (I am using this) unpacking any directory to /opt implies that it belongs to root owner and root group. This may be specific to Xampp as per the instructions on their Linux page:
Step 2: Installation After downloading simply type in the following commands:
Go to a Linux shell and login as the system administrator root:
su
Extract the downloaded archive file to /opt:
tar xvfz xampp-linux-1.8.1.tar.gz -C /opt
Warning: Please use only this command to install XAMPP. DON'T use any Microsoft Windows tools to extract the archive, it won't work.
Warning 2: already installed XAMPP versions get overwritten by this command.
That's all. XAMPP is now installed below the /opt/lampp directory.
* Step 3: Start To start XAMPP simply call this command:
/opt/lampp/lampp start
Placing it here implies that Apache must be run as root as one is only able to run it with sudo on Ubuntu.
This may be an issue specific to Ubuntu. Is it? Because Xampp is a development tool I posted this here as I am more likely to find an appropriate answer here from developers who use it on Ubuntu (and other Linux systems). I would appreciate any information on if the same problem occurs on other systems, I notice my production environment has Tomcat installed in /opt too, but belongs to tomcat: tomcat
The question here is how to get around this for all tools under /opt, because even though Xampp may not be the tool for my needs, I still want to place Tomcat under /opt to replicate my production environment and the same thing will surely happen unless this is just a Ubuntu issue?

Ubuntu and some other distributions differ to the general Linux principle where the account that you create upon install of the OS is added to specific groups that can be viewed with the following command:
groups username
You will notice that root is not amongst these. It is also not possible to log in or su to the root account. sudo is most likey a command that has been granted permission to be used from other accounts so I imagine the 'sudo' command has a file permission of 775 for user: root:root
Thus launching services from /opt' does not run them asroot`

Related

Installing software on server machine - the install process wants to modify root folders which I cannot access

I'm configuring software on my first web server, so I am not totally familiar with how everything works, but here is the basic problem:
I have purchased hosting on a web server that runs on CentOS. I have been able to install postgreSQL via an install process that the hoster provides, so that my database will be local only to my home folder. That is working fine.
However, I am trying to install a postgreSQL extension called PostGIS. I have tried to compile it from source on my web server, but it now requires an additional library called GEOS. I downloaded the library from http://download/osgeo.org/geos/geos-3.6.2.tar.bz2, extracted it, and used make install to run it.
Now the problem is that it fails due to this error:
/bin/mkdir: cannot create directory /usr/local/include/geos: Permission Denied
It's not really a surprise, because it is trying to make a new directory in the system root folders, rather than within my personal home folder, which is the only one I have access to. I can't think of any other way around this. Am I just unable to install this library? Or can I "trick" it somehow into installing in in my home directory, where I have full admin rights?
I think You need to execute a command with root user privileges.
Because, make install command need root user privileges.
Like,
sudo make install
or with root user. Like,
sudo su
make install

How can i fix/restore linux permissions without reinstalling / deleting my files?

I was trying to change permissons of a folder, and i typed in:
sudo chmod -R 777 /.
I believe it changed my whole system's permissons.
I can no longer connect using ssh/stfp to it.
How can i restore my system permissions without reinstalling / deleting any of my files?
I am using Ubuntu Server
The computer is 64 bit
The files / servers are working fine (HTTP, Games, ETC)
As per this link https://askubuntu.com/questions/508359/restore-default-system-file-folder-permessions you can restore the default system file/folder permissions in linux
and check with the Ubuntu version too.

Error when running emacs make install on remote machine

I am trying to install emacs on a machine that I'm accessing through ssh.
I downloaded the emacs-24.5.tar.gz which I transferred to the root directory of my remote machine.
I ran the ./configure command and then navigated to the emacs-24.5 folder and ran the make install command
I unfortunately ran into this error
/bin/mkdir: cannot create directory `/usr/local/share/icons': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/share/icons/hicolor/128x128/apps/emacs.png': No such file or directory
make: *** [install-etc] Error 1
How do I get emacs working on the remote machine now?
Your description of what steps you took make it a little difficult to know if you missed anything. For example, I'm assuming you ran tar on the tarball before you ran configure or make? Also, little concerned when you say you ran configure and THEN navigated to the 24.5 directory? You should be running make install from the same directory/folder where you ran configure. You also didn't indicate you had run make bootstrap.
The steps should be
scp emacs-24.5.tar.gz user#remote-host:~
ssh user#remote-host
tar xzf emacs-24.5.tar.gz
cd emacs-24.5
./configure
make bootstrap
sudo make install
Notice in the output from the make install there are directions on an additional command you need to run to set movemail permissions. This command also needs to be run under sudo
I'm assuming your not ssh'ing intot the remote host as root as this would be a bad practice. This means that when you do the make install, you need to run the process with root privileges, so you need to use sudo.
You should also check the output from configure and make sure there are no errors. Configure will also list emacs features which are turned on/off depending on whether you have various supporting libraries installed. If you scroll the terminal output from configure up a couple of pages, you will see the printout. If there are features listed with a 'no' which you want/expect, you will need to go through the documentation and work out which additional supporting libraries you need. However, most of the time, with modern linux distros setup for desktop use, everything will likely already be there. Might be different on a server and I can't speak about Windows and what it might require.

Drupal 7 Install on Redhat w/ Apache - sites/default/files is not writable

I have spent numerous hours on an issue that has left me puzzled. I am attempting to install Drupal on Linux Redhat using apache, but it will not allow me to pass step 3 due to the fact that sites/default/files is not writable.
I have followed the instructions on Drupal's site, in their install.txt file as well as the instructions of others who have had the same error with no success.
I have granted permissions access all different ways root:root 777, root:apache 777, I have verified that apache is the user running the apache process and I am still stuck.
Note: I was able to complete the install on windows.
Any new ideas?
Okay, so after following directions from both official and non-official web sources, the one thing that was never instructed to do or try was to reboot the application AFTER making permission changes to the files directory. I tried it, and this solved the issue.
This is weird because I've never had to reboot an OS after making permission changes on a directory. Additionally I did restart httpd after each change thinking that would be sufficient. Hopefully this can help anyone else running Redhat 7 with the same issue.
Thanks, TH
I solved this problem by changing the security context of the directory "sites".
My Drupal core files are in: /var/www/html/drupal
Then I applied the command:
chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/

Installing softwares witout sudo in centos for a single user only?

I am using centos 6 for which I am not having sudo access.I have a user account and have full access for that account. Is there a way to install packages/softwares for a particular user in Centos.
Just copy the executables into your home directory. You may also add it to your PATH variable. Many people has a ~/bin directory for this kind of stuffs.

Resources