2011年5月27日金曜日

【Ruby】条件演算子

条件演算子(三項演算子とも呼ばれる)

xx ? yy : zz
⇒「if xx then yy else zz end」 と同じ意味

(id = nil なら:create , 以外なら:update をparam に代入する例)
param =id.nil? ? :create : :update

2011年5月10日火曜日

CentOSで一般ユーザの作成&削除

root権限で入って作成

# useradd centos ← 一般ユーザcentosの作成
# passwd centos ← centosのパスワード設定
Changing password for user centos.
New UNIX password:  ← centosのパスワード応答
Retype new UNIX password:  ← centosのパスワード応答(確認)
passwd: all authentication tokens updated successfully.

# userdel -r centos ← 一般ユーザcentosの削除

ユーザー一覧確認
cat /etc/passwd

CentOSのバージョンを確認するコマンド

cat /etc/redhat-release

FTPセキュリティ

FTP接続の許可/不許可ユーザー
下記で設定

 /etc/hosts.deny
  まずすべてのユーザーのFTP接続を拒否
  → vsftpd :ALL

 /etc/hosts.allow
  FTP接続許可したいアドレス帯を設定する
  → vsftpd :192.XX.XXX. 127.0.0.1