Archive for the ‘linux’ Category

Changing files and folders so they are accessable by user and apache as well

Follow the commands below to change files and folders so they are accessible to users and the apache group as well by adding the user to the apache group and assigning full read, write, execute privileges to user and apache group.
cd /var/www
find . -type d | xargs chmod 775
find . -type f | xargs chmod [...]

More »

How to change owner of files or directories recursively in Linux?

To change owner of files or directories recursively in Linux use the following command: (MAKE SURE YU ARE IN THE DIRECTORY YOU WANT TO CHANGE THE FILES/FOLDERS WITHIN)
chown -R user/group — (substitute user/group with the user name and group name.
For example:
chown -R paul/administrator — (paul is the name of the user [...]

More »

How to get/find out the owner of a file or directory in Linux

You can use ls -l command (list information about the FILEs) to find our the file / directory owner and group names.
More information: http://www.cyberciti.biz/faq/unix-linux-find-file-owner-name/

More »

Listing and Editing Cron via Crontab

To list and edit crons, log in via SSH and use the following commands:
crontab -l to list crontabs
crontab -e to edit crontabs
editing is done in VI. Basic VI commands: http://www.cs.colostate.edu/helpdocs/vi.html

More »

How to install Midnight Commander 4.6.1

Midnight Commander is a very useful file manager.
Install Midnight Commander
# wget http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-4.6.1.tar.gz
# tar zxvf mc-4.6.1.tar.gz
# cd mc-4.6.1
# ./configure
# make
# make install
To run Midnight commander use

More »

Add users in ‘AllowUsers’ of SSH for SSH access

More »

Edit Sudoers File – visudo

1) Open the sudoers file safely:
visudo command edits the sudoers file in a safe fashion.
Attention: you can only run visudo as root
This is a vi editor. Here are some basic vi commands:
To enter vi insert mode: i
To enter vi command mode: [esc]
To exit vi and save changes: ZZ or :wq
To exit vi [...]

More »

How to restart SSH (restarting SSHD) remotely?

There are a few different ways to restart SSHD remotely.
You will need root access in order to do this.
1) /etc/init.d/sshd restart
2) kill `cat /var/run/sshd.pid` && /usr/sbin/sshd

More »

How to disable root login in Linux

It is a good idea to disable root login for security purposes and use your login name and use sudo to get root privileges.
First of all, make sure you have your own login name and you can get root privileges by using sudo.
So, open up /etc/ssh/sshd_config and comment out
AllowUsers root
so it will look like:
#AllowUsers admin
You [...]

More »

Linux shell restricting access

More »