Showing posts with label root. Show all posts
Showing posts with label root. Show all posts

Thursday, August 8, 2013

// // Leave a Comment

Linux: HowTo Copy a Folder [ Command Line Option ]

I'm a new Linux user. How do I copy a directory or folder under Linux operating system using command line options and bash shell?

You can use various command to copy a folder under Linux operating systems.

cp Command

cp is a Linux command for copying files and directories. The syntax is as follows:
 
cp source destination
cp dir1 dir2
cp -option  source destination
cp -option1 -option2  source destination
 
In this example copy /home/vivek/letters folder and all its files to /usb/backup directory:
 
cp -avr /home/vivek/letters /usb/backup
 
Where,
  • -a : Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.
  • -v : Explain what is being done.
  • -r : Copy directories recursively.

Example

Copy a folder called /tmp/conf to /tmp/backup:
$ cp -avr /tmp/conf/ /tmp/backup
Sample outputs:
HowTO: Copy Folder Linux Terminal Command
Fig.01: cp command in action

rsync Command

You can also use rsync command which is a fast and extraordinarily versatile file copying tool. It can make copies across the network. The syntax is as follows:
 
rsync -av /path/to/source /path/to/destination
rsync -av /path/to/source/ /path/to/destination/source
 
To backup my home directory, which consists of large files and mail folders to /media/backup, enter:
$ rsync -avz /home/vivek /media/backup
I can copy a folder to remote machine called server1.cyberciti.biz:
$ rsync -avz /home/vivek/ server1.cyberciti.biz:/home/backups/vivek
Where,
  • -a : Archive mode i.e. copy a folder with all its permission and other information including recursive copy.
  • -v : Verbose mode.
  • -z : With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted — something that is useful over a slow connection.
You can show progress during transfer using --progress or -P option:
$ rsync -av --progress /path/to/source/ /path/to/dest
Sample outputs:
Copy Folder Linux Commands [ rsync ]
Fig.02: rsync command in action
Read More

Thursday, November 29, 2012

// // Leave a Comment

How to Create a Backup using SSH Shell Commands.

How to make a backup using command prompt ? How to pack a user account using SSH putty ?
These similar questions are very common among newbies and new webmasters.
Here below is the code that you can use to pack a CPanel account.

1). Open SSH Command prompt window and login as root with your root password.
2). Run the below code and press enter.
Code:
/scripts/pkgacct username
Where username will be the username of the account you want to generate a backup for.
3). Your backup file will be available in /home/ directory fo your server.

CHEERS !
Read More

Saturday, September 24, 2011

// // Leave a Comment

How To Recover root password under linux with single user mode

It happens sometime that you can't remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
This tutorial will show how to boot Linux in single user mode when using GRUB and finally how to change root password.
During normal usage, a Linux OS runs under runlevels between 2 and 5 which corresponds to various multi-user modes. Booting Linux under runlevel 1 will allow one to enter into a specific mode, single user mode. Under such a level, you directly get a root prompt. From there, changing root password is a piece of cake.

1. Entering runlevel 1

Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated "Recovery Mode" or "Single-User Mode". If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.
Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
  • use the arrows to select the boot entry you want to modify.
  • press e to edit the entry
  • use the arrows to go to kernel line
  • press e to edit this entry
  • at the end of the line add the word single
  • press ESC to go back to the parent menu
  • press b to boot this kernel
The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).
Here we are, we have gained root access to the filesystem, let's finally change the password.

2. Changing root password

As root, changing password does not ask for your old password, therefore running the command:
# passwd
will prompt you for your new password and will ask you to confirm it to make sure there is no typo.
That's it, you can now reboot your box and gain root access again
Read More
// // Leave a Comment

How to change root password via ssh.

To change the root password via ssh, use the following steps:

1. Log in to ssh by using any client(recommended: Putty).

2. Run these commands after it
su - root
passwd
3. Enter your new password for root. Confirm your password by re-entering it.

DONE...!! YOUR PASSWORD FOR ROOT IS NOW UPDATED.

Read More
// // Leave a Comment

How to change a forgotten MySQL root password from SSH.

To change the MySQL root password, run the below commands as root:
/etc/init.d/mysql stop
killall -9 mysql 
/etc/init.d/mysql --skip-grant-tables --user=root start

Connect to mysql with the following command:
mysql -u root

Execute the below command in the mysql client: 
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';

The 'newpwd' will be the new password for the MySQL.
Read More

Sunday, September 4, 2011

// // Leave a Comment

How To Install FFmpeg Latest Version at CentOS5.5

This tutorial will guide you on how to install FFmpeg at CentOS5.5 with all the common errors that you may face. Before installing FFmpeg lets do some tests and make the system ready for FFmpeg installation.

Step 1) First of all open the directory /etc/yum.repos.d and create a new file dag.repo then paste the below code and save.


[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Step 2) Run the below command and the ffmpeg installation should run fine.

yum install ffmpeg ffmpeg-devel

Got some public key error ? Dont worry run below command to fix it and try again:


rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install ffmpeg ffmpeg-devel

Now FFmpeg should be installed without any problem, you can
test the installation by running the below command.

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

But Wait !
Would you like to install the FFmpeg-php extension ?
Install FFmpeg php extension.
Read More
// // Leave a Comment

Installing FFmpeg-PHP Extension at Linux

In this tutorial we will learn about installation of FFmpeg PHP extension. As we know that FFmpeg is a very useful tool for audio video conversion etc.

To install FFmpeg PHP extension you must install the FFmpeg first.
Visit Below:
http://w3tool.blogspot.com/2011/09/how-to-install-ffmpeg-latest-version-at.html

After you install the FFmpeg you can now move forward to install the php extension:

Step 1) Download the latest version of FFmpeg-php.
Visit the Below site:
http://ffmpeg-php.sourceforge.net
You can download the latest release using wget command. Click here to learn about wget linux command if you dont know about it.

After downloading you can see the downloaded package in your /root directory which is default.

Step 2) Now extract the file using below command:

 
tar -xjf name of the downloaded file

Step 3) Now enter to the extracted directory using below command:
 
cd Name of the extracted folder

Step 4) Now run below command:
Code:
phpize
if you get command not found error than probably you dont have the php devel installed.
Run the below command to fix it including the above command:
 
yum install php-devel
phpize

Step 5) Now run below command to install the FFmpeg-php:
 
./configure
make
make install
if you get header not found or some similar error then you can fix it by running the below command with the above one:
Code:
yum install ffmpeg-devel
./configure
make
make install
if you get error similar to shared library not found then run the commands given below:
 
./configure --with-ffmpeg=/usr/local/cpffmpeg
./configure
make
make install

Now ffmpeg should be installed correctly without any problem.


Step 6) Now at the end you will need to edit your php.ini file, paste the below code to load the FFmpeg module in php and save it.
 
[ffmpeg]
extension=ffmpeg.so


Step 7) Restart the apache and your FFmpeg installation has been completed.
Code:
service httpd restart

Addons: Now you may want to install some addons like Mencoder and mplayer.
Use below command to install them:
Code:
yum install mplayer mencoder
Read More