ラベル Linux の投稿を表示しています。 すべての投稿を表示
ラベル Linux の投稿を表示しています。 すべての投稿を表示

2016年4月7日木曜日

.screenrc

Screenの設定ファイルはこんな感じで
term screen-256color
escape ^Oo
termcapinfo xterm* ti@:te@

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%t%n*%f%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
チートシート: http://www.pixelbeat.org/lkdb/screen.html

2015年4月18日土曜日

CentOSでFTPサーバーを立てる(3分で)

インストール
sudo yum install vsftpd -y
起動
service vsftpd status
SELinuxを切る(重要)
setenforce 0
クライアント側から接続
$ ftp (ip_address)
ダウンロード
ftp> pwd
257 "/home/sato"
ftp> get images.tar.gz

2015年4月7日火曜日

カラフルで素晴らしいPS1シェルプロンプト

PS1シェルプロンプト

素晴らしいシェルプロンプトを作っている人が。。
gitのブランチをプロンプトにだすという素晴らしいアイディア
http://unix.stackexchange.com/a/178817

Bash $PS1 Generator2.0を使ってさらに好みにしてみた
https://www.kirsle.net/wizards/ps1.html

~/.bashrc以下を追加

git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\t \[$(tput setaf 4)\]\u@\h\[$(tput setaf 1)\] \W \[$(tput setaf 3)\]\$(git_branch)\[$(tput sgr0)\] $ \[$(tput sgr0)\]"

gitないとき

# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\t \[$(tput setaf 4)\]\u@\h\[$(tput setaf 1)\] \W \[$(tput sgr0)\] $ \[$(tput sgr0)\]"

完成!!

2015年2月21日土曜日

sudoの設定

sudo関連の設定はこれでOK

rootユーザーからvisudoで編集

sudo権限を与えたいユーザーを登録。
NOPASSWORDでパスワードをいちいち問わせない

sato    ALL=(ALL)       NOPASSWD: ALL

secure_pathをコメントアウト

#Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

env_keepにPATHを追加

Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY PATH"

2014年9月21日日曜日

Mongodbへのリモートアクセス

最初にユーザーを作る
Mongodbはデフォルトでユーザーはいないので認証をONにする前に作っておく
ユーザーはDBに所属するので、使用したいDBに切り替えてから作る
use mydb
db.addUser('sato','password')
/etc/mongodb.confの以下の行をコメント解除
auth=true

以下の行をコメントにする
#bind_ip = 0.0.0.0

mongodの再起動
service mongod restart

IPTABLESを設定
iptables -A INPUT -p tcp --dport 27017 -j ACCEPT
iptables -A INPUT -p tcp --sport 27017 -j ACCEPT

IPTABLESの設定を保存
/etc/init.d/iptables save

再起動
service iptables restart


接続
mongo [host_IP]/ -u sato -p password