Archive for the tag 'shell'

Shell description is missed in crontab files after migration.

After the migration to the Parallels Plesk Panel 10.x, the cron jobs are not executed by chrootsh.

The SHELL value in the crontab is not copied from the target to the destination server during the migration. Say, servers A and B are configured to use chroot shell. When migrating a customer account with crontab and the SHELL value is omitted:

To resolve this issue, Determine the path to the chrootsh utility with the following command:

# grep chroot /etc/shells

Add the SHELL value to the crontab with the command:

# /usr/local/psa/bin/server_pref -u -crontab-secure-shell

Reference : http://parallels.com

Transferring all your cpanel accounts using shell.

First we need to create all accounts backup on your current server, execute following command

cat /var/cpanel/users | while read line; do
/scripts/pkgacct $line
done

All accounts are backuped up under /home, now transfer all accounts backup to your new server using SCP command line.

scp cpmove-* root@new-server-ip:/home

Now to resoter the accounts.

To restore all accounts, put all the users in the file named users on the new server /home

cat /home/users | while read line; do
/scripts/restorepkg $line
done

Creating and editing users in MySQL from shell prompt.

First we need to login into MySQL server as root.

mysql -u root -p

Will be prompted for your MySQL root password (note this is not the same as the server root password).

mysql> create user ‘buddy@localhost’ identified by ‘new-password’;
Query OK, 0 rows affected (0.12 sec)

Next we need to flush the privileges which reloads the ‘user’ table in MySQL - do this each time you add or edit users.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

To give the user buddy select permission on all the databases, this allows the user to read, but not edit and delete.

mysql> grant select on *.* to ‘buddy’@'localhost’;
Query OK, 0 rows affected (0.00 sec)

The GRANT statement enables system administrators to create MySQL user accounts and to grant rights to accounts. To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting. The REVOKE statement is related and enables administrators to remove account privileges.

SBDavid

Shell Command Aliases

Shell Command Aliases

A command alias allows you to create an alias name for common commands (along with their
parameters) to help keep your typing to a minimum.

Most likely your Linux distribution has already set some common command aliases for you. To
see a list of the active aliases, use the alias command with the -p parameter:

Example:

$ alias -p
alias l.=’ls -d .* –color=tty’
alias ll=’ls -l –color=tty’
alias ls=’ls –color=tty’
alias vi=’vim’
alias which=’alias | /usr/bin/which –tty-only –read-
alias–show-dot –show-tilde’
SBDavid

Linux Login shell

When you log in to the Linux system, the bash shell starts as a login shell. The login shell looks for four different startup files to process commands from. The order in which the bash shell processes the files are:

/etc/profile
$HOME/.bash profile
$HOME/.bash login
$HOME/.profile

The /etc/profile file is the main default startup file for the bash shell on the system. Every user on the system executes this startup file when they log in. The other three startup files are specific for each user and can be customized for each user’s requirements.

Next »