set -o noclobber
echo “some text”> protected.txt
turn off noclobber:
set +o noclobber
set -o noclobber
echo “some text”> protected.txt
turn off noclobber:
set +o noclobber
modprobe vzcpt
vzctl set 1010 –cpus 1 –save
tcpdump -nn “(tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)”
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED,RELATED -j ACCEPT
psql
select * from pg_stat_activity;
Passwords are not encrypted, so:
su – postgres
psql
\l
\c DB_NAME
SELECT login, password FROM res_users WHERE login = ‘admin’;
or
SELECT login, password FROM res_users;
change to postgres user and open psql prompt
sudo -u postgres psql postgres
list databases
postgres=# \l
list roles
postgres=# \du
create role
postgres=# CREATE ROLE demorole1 WITH LOGIN ENCRYPTED PASSWORD ‘password1’ CREATEDB;
create role with multiple privileges
postgres=# CREATE ROLE demorole1 WITH LOGIN ENCRYPTED PASSWORD
postgres=# ‘password1’ CREATEDB CREATEROLE REPLICATION SUPERUSER;
alter role
postgres=# ALTER ROLE demorole1 CREATEROLE CREATEDB REPLICATION SUPERUSER;
drop role
postgres=# DROP ROLE demorole1;
create database
postgres=# CREATE DATABASE demodb1 WITH OWNER demorole1 ENCODING ‘UTF8’;
grant privileges to new user
postgres=# GRANT ALL PRIVILEGES ON DATABASE demodb1 TO demorole1;
drop database
postgres=# DROP DATABASE demodb1;
connect to database
postgres=# \c
list tables in connected database
postgres=# \dt
list columns on table
postgres=# \d
$ pg_dump
If you see this message on OpenVZ container. if sh exists or this is symbolic link, usually it means you have some damaged binary files. You can take them from OS template.
/usr/local/cpanel/cpanel -V
if is stable or released:
grep CPANEL /etc/cpupdate.conf
chmod 750 /var/empty/sshd
yum install fcgi-devel
vi Gemfile.local
gem ‘fcgi’
yum install fcgi-devel
gem install fcgi
bundle install –without development test
If you trying install mysql on fresh Debian VPS (OpenVZ template):
Stopping MySQL database server: mysqld.
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 146: logger: command not found
ATTENTION: An error has occured. More info is in the syslog!
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 236: logger: command not found
dpkg: error processing mysql-server-5.5 (–configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
Quick fix:
apt-get install bsdutils
also you can get such errors:
dpkg: error processing mysql-server (–configure):
dependency problems – leaving unconfigured
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
loadkeys US
vi /etc/sysconfig/keyboard
KEYTABLE=”us”
MODEL=”pc105+inet”
LAYOUT=”us”
KEYBOARDTYPE=”pc”