feedburner
Enter your email address:

Delivered by FeedBurner

feedburner count

How to change ISPConfig admin user password

In order to change ISPConfig administrator password you will have to connect to your MySQL using the command line. It can be done using the following command:

  • mysql -u root -p[yourrootpassword]

After that select the database called "dbispconfig". This can be done using the following command:

  • use dbispconfig; - selects the MySQL database called "dbispconfig"

Finnally execute the following command to change password :

  • UPDATE sys_user SET passwort = md5('NEWPASSWORD') WHERE username = 'admin'; - enter your desired password where text "NEWPASSWORD" is present.

After that simply connect to your ISPConfig using new admin password!

Read More.. Digg ThisAdd To Del.icio.us Add To Reddit Fav This With Technorati Add To Yahoo MyWeb Add To Newsvine Add To Google Bookmarks Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This



How to Add an Admin User to the WordPress Database via MySQL


First, you need to login to phpMyAdmin and locate your WordPress database. (Below is a screenshot of a Hosting cPanel)

cPanel phpMyAdmin

Once you are in, we will be making changes to the wp_users and wp_usermeta tables. Lets go ahead and click on wp_users table.

phpMyAdmin wp_users table

We need to insert our new admin user's information, so click on the Insert tab like it shows in the image above. In the insert form, add the following:

  • ID – pick a number (in our example, we will use the number 4).
  • user_login – insert the username you want to use to access the WordPress Dashboard.
  • user_pass – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
  • user_nicename – put a nickname or something else that you would like to refer yourself as.
  • user_email – add the email you want to associate with this account.
  • user_url – this would be the url to your website.
  • user_registered – select the date/time for when this user is registered.
  • user_status – set this to 0.
  • display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
  • Click on the Go Button

phpMyAdmin Insert values in wp_users table

Next we are going to have to add the values to wp_usermeta table. Click on the wp_usermeta table and then click on the Insert tab just like the previous step. Then add the following information to the insert form:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  • meta_key – this should be wp_capabilities
  • meta_value – insert this: a:1:{s:13:"administrator";s:1:"1";}

Insert another row with the following information:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  • meta_key – this should be wp_user_level
  • meta_value – 10

Then click on the Go button, and you have created yourself a new username. Now you should be able to login to your wp-admin with the username and password you specified for this user. Once logged in, click on Users and edit the username you just created. Go down and click on the Save button (you don't have to change anything). This will allow WordPress to go through and add some more information and clean-up the user we just added.

SQL query

For developers who want to speed this process up, you can simply drop this SQL query in your database.

1INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4''demo', MD5('demo'), 'pratama''test@yourdomain.com''http://computer.pratama.us/','2011-06-07 00:00:00''''0''Syed Balkhi');
2 
3 
4INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4','wp_capabilities''a:1:{s:13:"administrator";s:1:"1";}');
5 
6 
7INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4','wp_user_level''10');

Remember to change the databasename to the database you are working with. Also don't forget to change the appropriate values.

source:wpbeginner.com

Read More.. Digg ThisAdd To Del.icio.us Add To Reddit Fav This With Technorati Add To Yahoo MyWeb Add To Newsvine Add To Google Bookmarks Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This



How to recover deleted files on Linux



On a typical file system, deleting a file doesn't necessarily mean that it is gone for good. When a file is removed, its meta data (e.g., file name, size, time, location of data block, etc.) is gone, but actual file data is untouched inside the file system, until the location of the data is overwritten by other file data. This means that if you accidentally deleted a file, there is a chance that you can recover the file.

In this tutorial, I describe how to recover deleted files on Linux. There are several file recovery tools on Linux. Among them is PhotoRec which is an open source file recovery software licensed with GPLV v2+. PhotoRec is available on Linux, BSD, MacOS X and Windows.

PhotoRec Features

As the name implies, PhotoRec is originally designed to restore accidentally deleted digital photos. However, now it has become versatile enough to support various file formats. PhotoRec recovers lost files by checking data blocks one by one against a signature database of different file types.

  • Supported file formats: video (avi, mov, mp3, mp4, mpg), image (jpg, gif, png), audio (mp3, ogg), document (doc(x), ppt(x), xls(x), html), archive (gz, zip) etc.
  • Supported file systems: EXT2, EXT3, EXT4, HFS+, FAT, NTFS, exFAT

Besides hard disks, PhotoRec can restore files stored on CD/DVD drives, USB sticks, memory cards (CompactFlash, Memory Stick, Secure Digital/SD, SmartMedia), etc. So if you accidentally lost digital pictures stored on the memory card of a digital camera, you can use PhotoRec to undelete them.

Install PhotoRec on Linux

The official site offers PhotoRec binaries for various platforms. So you can download static PhotoRec binary for your Linux system.

For 32-bit Linux:

$ wget http://www.cgsecurity.org/testdisk-6.14.linux26.tar.bz2
$ tar xvfvj testdisk-6.14.linux26.tar.bz2

For 64-bit Linux:

$ wget http://www.cgsecurity.org/testdisk-6.14.linux26-x86_64.tar.bz2
$ tar xvfvj testdisk-6.14.linux26-x86_64.tar.bz2

The PhotoRec executable (photorec_static) is found in the extracted directory.

Recover Deleted Photos and Videos

In this tutorial, I demonstrate how to recover deleted photos and video files stored on an SD card, which were generated by Canon EOS Rebel T3i.

When you have removed a file accidentally, what's important is to NOT save any more files on the same disk drive or memory card, so that you do not overwrite the deleted file.

As soon as you discover the lost files, run PhotoRec to restore them as follows.

$ sudo photorec_static

You will be shown a list of available media. Choose the media where you have deleted files.

Next, choose the partition which contains deleted files.

Choose the file system type used for the partition. In general, you can identify the file system type from the output of mountcommand. In case of the SD card used by Canon camera, it is formatted in VFAT file system. So choose "Other".

Choose if all disk space needs to be analyzed. In this case, choose "Free", which means scanning for unallocated space only.

Choose a destination folder where restored files will be stored. Here you must choose a different partition or drive than the one being analyzed. Press "C" when a destination is chosen.

Now PhotoRec starts reading individual sectors for lost files. You will see the progress of the recovery. Depending on the size of media, it will take a couple of minutes or even longer.

After scanning is completed, the restored files will be stored in the destination folder that you configured. Note that the size of a restored file may be either the same as or larger than the original file size.

source: xmodulo.com

Read More.. Digg ThisAdd To Del.icio.us Add To Reddit Fav This With Technorati Add To Yahoo MyWeb Add To Newsvine Add To Google Bookmarks Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This



Bring back deleted files with lsof

There you are, happily playing around with an audio file you've spent all afternoon tweaking, and you're thinking, "Wow, doesn't it sound great? Lemme just move it over here." At that point your subconscious chimes in, "Um, you meant mv, not rm, right?" Oops. I feel your pain -- this happens to everyone. But there's a straightforward method to recover your lost file, and since it works on every standard Linux system, everyone ought to know how to do it.

Briefly, a file as it appears somewhere on a Linux filesystem is actually just a link to an inode, which contains all of the file's properties, such as permissions and ownership, as well as the addresses of the data blocks where the file's content is stored on disk. When you rm a file, you're removing the link that points to its inode, but not the inode itself; other processes (such as your audio player) might still have it open. It's only after they're through and all links are removed that an inode and the data blocks it pointed to are made available for writing.

This delay is your key to a quick and happy recovery: if a process still has the file open, the data's there somewhere, even though according to the directory listing the file already appears to be gone.

This is where the Linux process pseudo-filesystem, the /proc directory, comes into play. Every process on the system has a directory here with its name on it, inside of which lies many things -- including an fd ("file descriptor") subdirectory containing links to all files that the process has open. Even if a file has been removed from the filesystem, a copy of the data will be right here:

/proc/process id/fd/file descriptor

To know where to go, you need to get the id of the process that has the file open, and the file descriptor. These you get with lsof, whose name means "list open files." (It actually does a whole lot more than this and is so useful that almost every system has it installed. If yours isn't one of them, you can grab the latest version straight from its author.)

Once you get that information from lsof, you can just copy the data out of /proc and call it a day.

This whole thing is best demonstrated with a live example. First, create a text file that you can delete and then bring back:

$ man lsof | col -b > myfile

Then have a look at the contents of the file that you just created:

$ less myfile

You should see a plaintext version of lsof's huge man page looking out at you, courtesy of less.

Now press Ctrl-Z to suspend less. Back at a shell prompt make sure your file is still there:

$ ls -l myfile  -rw-r--r--  1 jimbo jimbo 114383 Oct 31 16:14 myfile  $ stat myfile    File: `myfile'    Size: 114383          Blocks: 232        IO Block: 4096   regular file  Device: 341h/833d       Inode: 1276722     Links: 1  Access: (0644/-rw-r--r--)  Uid: ( 1010/    jimbo)   Gid: ( 1010/    jimbo)  Access: 2006-10-31 16:15:08.423715488 -0400  Modify: 2006-10-31 16:14:52.684417746 -0400  Change: 2006-10-31 16:14:52.684417746 -0400  

Yup, it's there all right. OK, go ahead and oops it:

$ rm myfile  $ ls -l myfile  ls: myfile: No such file or directory  $ stat myfile  stat: cannot stat `myfile': No such file or directory  $  

It's gone.

At this point, you must not allow the process still using the file to exit, because once that happens, the file will really be gone and your troubles will intensify. Your background less process in this walkthrough isn't going anywhere (unless you kill the process or exit the shell), but if this were a video or sound file that you were playing, the first thing to do at the point where you realize you deleted the file would be to immediately pause the application playback, or otherwise freeze the process, so that it doesn't eventually stop playing the file and exit.

Now to bring the file back. First see what lsof has to say about it:

$ lsof | grep myfile  less      4158    jimbo    4r      REG       3,65   114383   1276722 /home/jimbo/myfile (deleted)  

The first column gives you the name of the command associated with the process, the second column is the process id, and the number in the fourth column is the file descriptor (the "r" means that it's a regular file). Now you know that process 4158 still has the file open, and you know the file descriptor, 4. That's everything you have to know to copy it out of /proc.

You might think that using the -a flag with cp is the right thing to do here, since you're restoring the file -- but it's actually important that you don't do that. Otherwise, instead of copying the literal data contained in the file, you'll be copying a now-broken symbolic link to the file as it once was listed in its original directory:

$ ls -l /proc/4158/fd/4  lr-x------  1 jimbo jimbo 64 Oct 31 16:18 /proc/4158/fd/4 -> /home/jimbo/myfile (deleted)  $ cp -a /proc/4158/fd/4 myfile.wrong  $ ls -l myfile.wrong  lrwxr-xr-x  1 jimbo jimbo 24 Oct 31 16:22 myfile.wrong -> /home/jimbo/myfile (deleted)  $ file myfile.wrong  myfile.wrong: broken symbolic link to `/home/jimbo/myfile (deleted)'  $ file /proc/4158/fd/4  /proc/4158/fd/4: broken symbolic link to `/home/jimbo/myfile (deleted)'  

So instead of all that, just a plain old cp will do the trick:

$ cp /proc/4158/fd/4 myfile.saved

And finally, verify that you've done good:

$ ls -l myfile.saved  -rw-r--r--  1 jimbo jimbo 114383 Oct 31 16:25 myfile.saved  $ man lsof | col -b > myfile.new  $ cmp myfile.saved myfile.new  

No complaints from cmp -- your restoration is the real deal.

Incidentally, there are a lot of useful things you can do with lsof in addition to rescuing lost files.

source: http://archive09.linux.com/articles/58142

Read More.. Digg ThisAdd To Del.icio.us Add To Reddit Fav This With Technorati Add To Yahoo MyWeb Add To Newsvine Add To Google Bookmarks Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This

15 Linux lsof Command Examples (Identify Open Files)

lsof stands for List Open Files.

It is easy to remember lsof command if you think of it as "ls + of", where ls stands for list, and of stands for open files.

It is a command line utility which is used to list the information about the files that are opened by various processes. In unix, everything is a file, ( pipes, sockets, directories, devices, etc.). So by using lsof, you can get the information about any opened files.

1. Introduction to lsof

Simply typing lsof will provide a list of all open files belonging to all active processes.

# lsof    COMMAND  PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME  init       1       root  cwd       DIR        8,1      4096          2 /  init       1       root  txt       REG        8,1    124704     917562 /sbin/init  init       1       root    0u      CHR        1,3       0t0       4369 /dev/null  init       1       root    1u      CHR        1,3       0t0       4369 /dev/null  init       1       root    2u      CHR        1,3       0t0       4369 /dev/null  init       1       root    3r     FIFO        0,8       0t0       6323 pipe  ...

By default One file per line is displayed. Most of the columns are self explanatory. We will explain the details about couple of cryptic columns (FD and TYPE).

FD – Represents the file descriptor. Some of the values of FDs are,

  • cwd – Current Working Directory
  • txt – Text file
  • mem – Memory mapped file
  • mmap – Memory mapped device
  • NUMBER – Represent the actual file descriptor. The character after the number i.e '1u', represents the mode in which the file is opened. r for read, w for write, u for read and write.

TYPE – Specifies the type of the file. Some of the values of TYPEs are,

  • REG – Regular File
  • DIR – Directory
  • FIFO – First In First Out
  • CHR – Character special file

For a complete list of FD & TYPE, refer man lsof.

2. List processes which opened a specific file

You can list only the processes which opened a specific file, by providing the filename as arguments.

# lsof /var/log/syslog    COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME  rsyslogd 488 syslog    1w   REG    8,1     1151 268940 /var/log/syslog

3. List opened files under a directory

You can list the processes which opened files under a specified directory using '+D' option. +D will recurse the sub directories also. If you don't want lsof to recurse, then use '+d' option.

# lsof +D /var/log/    COMMAND   PID   USER  FD   TYPE DEVICE SIZE/OFF   NODE NAME  rsyslogd  488 syslog   1w   REG    8,1     1151 268940 /var/log/syslog  rsyslogd  488 syslog   2w   REG    8,1     2405 269616 /var/log/auth.log  console-k 144   root   9w   REG    8,1    10871 269369 /var/log/ConsoleKit/history

4. List opened files based on process names starting with

You can list the files opened by process names starting with a string, using '-c' option. -c followed by the process name will list the files opened by the process starting with that processes name. You can give multiple -c switch on a single command line.

# lsof -c ssh -c init    COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME  init         1       root  txt    REG        8,1   124704  917562 /sbin/init  init         1       root  mem    REG        8,1  1434180 1442625 /lib/i386-linux-gnu/libc-2.13.so  init         1       root  mem    REG        8,1    30684 1442694 /lib/i386-linux-gnu/librt-2.13.so  ...  ssh-agent 1528 lakshmanan    1u   CHR        1,3      0t0    4369 /dev/null  ssh-agent 1528 lakshmanan    2u   CHR        1,3      0t0    4369 /dev/null  ssh-agent 1528 lakshmanan    3u  unix 0xdf70e240      0t0   10464 /tmp/ssh-sUymKXxw1495/agent.1495

5. List processes using a mount point

Sometime when we try to umount a directory, the system will say "Device or Resource Busy" error. So we need to find out what are all the processes using the mount point and kill those processes to umount the directory. By using lsof we can find those processes.

# lsof /home

The following will also work.

# lsof +D /home/

6. List files opened by a specific user

In order to find the list of files opened by a specific users, use '-u' option.

# lsof -u lakshmanan    COMMAND    PID       USER   FD   TYPE     DEVICE SIZE/OFF       NODE NAME  update-no 1892 lakshmanan   20r  FIFO        0,8      0t0      14536 pipe  update-no 1892 lakshmanan   21w  FIFO        0,8      0t0      14536 pipe  bash      1995 lakshmanan  cwd    DIR        8,1     4096     393218 /home/lakshmanan

Sometimes you may want to list files opened by all users, expect some 1 or 2. In that case you can use the '^' to exclude only the particular user as follows

# lsof -u ^lakshmanan    COMMAND    PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME  rtkit-dae 1380      rtkit    7u     0000        0,9         0       4360 anon_inode  udisks-da 1584       root  cwd       DIR        8,1      4096          2 /

The above command listed all the files opened by all users, expect user 'lakshmanan'.

7. List all open files by a specific process

You can list all the files opened by a specific process using '-p' option. It will be helpful sometimes to get more information about a specific process.

# lsof -p 1753    COMMAND  PID       USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME  bash    1753 lakshmanan  cwd    DIR    8,1     4096  393571 /home/lakshmanan/test.txt  bash    1753 lakshmanan  rtd    DIR    8,1     4096       2 /  bash    1753 lakshmanan  255u   CHR  136,0      0t0       3 /dev/pts/0  ...

8. Kill all process that belongs to a particular user

When you want to kill all the processes which has files opened by a specific user, you can use '-t' option to list output only the process id of the process, and pass it to kill as follows

# kill -9 `lsof -t -u lakshmanan`

The above command will kill all process belonging to user 'lakshmanan', which has files opened.

Similarly you can also use '-t' in many ways. For example, to list process id of a process which opened /var/log/syslog can be done by

# lsof -t /var/log/syslog    489

Talking about kill, did you know that there are 4 Ways to Kill a Process?

9. Combine more list options using OR/AND

By default when you use more than one list option in lsof, they will be ORed. For example,

# lsof -u lakshmanan -c init    COMMAND    PID       USER   FD   TYPE     DEVICE SIZE/OFF       NODE NAME  init         1       root  cwd    DIR        8,1     4096          2 /  init         1       root  txt    REG        8,1   124704     917562 /sbin/init  bash      1995 lakshmanan    2u   CHR      136,2      0t0          5 /dev/pts/2  bash      1995 lakshmanan  255u   CHR      136,2      0t0          5 /dev/pts/2  ...

The above command uses two list options, '-u' and '-c'. So the command will list process belongs to user 'lakshmanan' as well as process name starts with 'init'.

But when you want to list a process belongs to user 'lakshmanan' and the process name starts with 'init', you can use '-a' option.

# lsof -u lakshmanan -c init -a

The above command will not output anything, because there is no such process named 'init' belonging to user 'lakshmanan'.

10. Execute lsof in repeat mode

lsof also support Repeat mode. It will first list files based on the given parameters, and delay for specified seconds and again list files based on the given parameters. It can be interrupted by a signal.

Repeat mode can be enabled by using '-r' or '+r'. If '+r' is used then, the repeat mode will end when no open files are found. '-r' will continue to list,delay,list until a interrupt is given irrespective of files are opened or not.

Each cycle output will be separated by using '======='. You also also specify the time delay as '-r' | '+r'.

# lsof -u lakshmanan -c init -a -r5    =======  =======  COMMAND   PID       USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME  inita.sh 2971 lakshmanan  cwd    DIR    8,1     4096  393218 /home/lakshmanan  inita.sh 2971 lakshmanan  rtd    DIR    8,1     4096       2 /  inita.sh 2971 lakshmanan  txt    REG    8,1    83848  524315 /bin/dash  inita.sh 2971 lakshmanan  mem    REG    8,1  1434180 1442625 /lib/i386-linux-gnu/libc-2.13.so  inita.sh 2971 lakshmanan  mem    REG    8,1   117960 1442612 /lib/i386-linux-gnu/ld-2.13.so  inita.sh 2971 lakshmanan    0u   CHR  136,4      0t0       7 /dev/pts/4  inita.sh 2971 lakshmanan    1u   CHR  136,4      0t0       7 /dev/pts/4  inita.sh 2971 lakshmanan    2u   CHR  136,4      0t0       7 /dev/pts/4  inita.sh 2971 lakshmanan   10r   REG    8,1       20  393578 /home/lakshmanan/inita.sh  =======

In the above output, for the first 5 seconds, there is no output. After that a script named "inita.sh" is started, and it list the output.

Finding Network Connection

Network connections are also files. So we can find information about them by using lsof.

11. List all network connections

You can list all the network connections opened by using '-i' option.

# lsof -i    COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME  avahi-dae  515 avahi   13u  IPv4   6848      0t0  UDP *:mdns  avahi-dae  515 avahi   16u  IPv6   6851      0t0  UDP *:52060  cupsd     1075  root    5u  IPv6  22512      0t0  TCP ip6-localhost:ipp (LISTEN)

You can also use '-i4′ or '-i6′ to list only 'IPV4′ or 'IPV6' respectively.

12. List all network files in use by a specific process

You can list all the network files which is being used by a process as follows

# lsof -i -a -p 234

You can also use the following

# lsof -i -a -c ssh

The above command will list the network files opened by the processes starting with ssh.

13. List processes which are listening on a particular port

You can list the processes which are listening on a particular port by using '-i' with ':' as follows

# lsof -i :25    COMMAND  PID        USER   FD   TYPE DEVICE SIZE NODE NAME  exim4   2541 Debian-exim    3u  IPv4   8677       TCP localhost:smtp (LISTEN)

14. List all TCP or UDP connections

You can list all the TCP or UDP connections by specifying the protocol using '-i'.

# lsof -i tcp; lsof -i udp;

15. List all Network File System ( NFS ) files

You can list all the NFS files by using '-N' option. The following lsof command will list all NFS files used by user 'lakshmanan'.

# lsof -N -u lakshmanan -a
Read More.. Digg ThisAdd To Del.icio.us Add To Reddit Fav This With Technorati Add To Yahoo MyWeb Add To Newsvine Add To Google Bookmarks Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This