This blog moved to medium->https://medium.com/@cocoamaemae

Tuesday, June 21, 2016

How to do ssh login by root on Linux

Brief

It can't be done ssh login by root on Linux default configuration.
The below is the solution.

Environment

CentOS[6-7]

Procedure

1. Put id_rsa under /root/.ssh/ on a client side and authorized_key under /root/.ssh/ on a server side

2. Comment the below portion on /etc/ssh/sshd_config
#PermitRootLogin no

3. Add the below on /etc/ssh/sshd_config
PermitRootLogin without-password

4. Restart sshd
(CentOS7)
sudo systemctl restart sshd

(CentOS6)
sudo service restart sshd

Wednesday, May 18, 2016

How to create or remove symbolic link

What's symbolic link?
Symbolic link is a special kind of link that points to another file.
After created, a link target file is replaced as source file.

How to create symbolic link
ln -s <source file name> <link target file name>

e.g.
$ ln -s /usr/local/bin/ruby /usr/bin/ruby

$ ls -alt /usr/bin/ruby
/usr/bin/ruby -> /usr/local/bin/ruby

How to remove symbolic link

use unlink or rm

e.g.
unlink /usr/bin/ruby
rm /usr/bin/ruby

Monday, May 16, 2016

How to use telnet

What's telnet?
A simple CUI telnet client. 
Telnet itself is the abbreviation of "telecommunication network". 
It means a protocol originally.

Basic syntax
telnet <a IP address or a host name> <a port number> 

e.g.

# Connect to 189.0.0.3 by port 30
telnet 189.0.0.3 80
Trying 189.0.0.3...
Connected to 189.0.0.3.
Escape character is '^]'.

# After the connection is successful,  you can exit by running Ctrl + ] and Ctrl + d.

Thursday, February 25, 2016

How to change Linux prompt display

OS: Linux
Shell: bash

In $HOME/.bash_profile or $HOME/.bashrc, write the below.

# bash default prompt name
case $TERM in
kterm|xterm|mlterm|cygwin|vt102|screen)
export PS1="[centos7.0_devel]$ "
esac


PS1 is custom prompt name. If you run Linux prompt.

Monday, February 1, 2016

TIPS regarding RDB index of MySQL and MariaDB


・The number of index increases too much, it is same as making book fat. Not to increase too much is significant.

・Not mix ASC and DESC. In the case, index is not available.
e.g. 
SELECT * FROM t1 ORDER BY key1 DESC, key2 ASC.

・If the keys used in where clause and used in order clause are different,  index is not available.
e.g.
SELECT * FROM t1 WHERE key21 = 'hoge' AND key22='fuge' ORDER BY key11;

・If you have no idea how to set index which columns,  the following order is available

  1. Create index to all columns
  2. Execute "explain" to SQL and show index conditions
  3. Create composite index to keys in possible_keys
・If you used composite index, the left index must be specified in where clause.


Wednesday, January 6, 2016

What is mysql_safe

What's mysql_safe
A daemon to monitor mysqld process.

When executing /etc/init.d/mysql start, mysqld is running in mysql_safe

Tuesday, January 5, 2016

Linux ssh management

Brief
Surmise ssh management on Linux

How to create a ssh key pair
execute ssh-keygen command and then $HOME/.ssh directory and $HOME/.ssh/id_rsa and $HOME/.ssh/id_rsa.pub are created automatically by default.

# .ssh folder permission
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/id_rsa


How to add a public key on a ssh server
# add a public key

cat <public key file> >> ~/.ssh/authorized_keys

# change permission
chmod 600 ~/.ssh/authorized_keys

# If from is used, the access origin can be limited
e.g.
from="xxxx.xxxx.xxxx.xxx",no-pty ssh-rsa ***


How to configure ssh authentication
// Modify /etc/ssh/sshd_config and comment out the blow portions.
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFils .ssh/authorized_keys

// To make a password authentication off
PasswordAuthentication no

After modified, restart sshd



Front End Development Tools

TaskRunner Tool executing multiple tasks by only one execution. Tasks are like CSS preprocessor, Transpire, Module Bundler, etc... e.g. ...