[[:お仕事メモ]] #contents *bashを使う [#t78f4b75] /usr/ports/shells/ #make install clean #chsh -s /usr/local/bin/bash *ネットワーク設定 [#a7553d6a] **IP固定 [#o4a017c6] /etc/rc.conf -ifconfig_em0="DHCP" +ifconfig_em0="inet 192.168.136.151 netmask 255.255.255.0" +defaultrouter="192.168.136.254" **DNS設定 [#u8984539] /etc/resolv.conf +nameserver 192.168.136.200 +nameserver 192.168.136.201 *ユーザ作成 [#k33a174a] #addusers Username: admin Full name: admin Uid (Leave empty for default): 2000 Login group [admin]: wheel Login group is users. Invite admin into other groups? []: wheel Login class [default]: default Shell (sh csh tcsh nologin) [sh]: bash Home directory [/home/admin]: /home/admin Use password-based authentication? [yes]: yes Use an empty password? (yes/no) [no]: no Use a random password? (yes/no) [no]: no Enter password: Enter password again: Lock out the account after creation? [no]: no Username : 68user Password : ***** Full Name : 68user Uid : 2000 Class : Groups : users wheel Home : /home/admin Shell : /bin/tcsh Locked : no OK? (yes/no): yes adduser: INFO: Successfully added (admin) to the user database. Add another user? (yes/no): no Goodbye! *Telnet [#v38b5d6a] /etc/rc.conf +inetd_enable="YES" /etc/inetd.conf +telnet stream tcp nowait root /usr/libexec/telnetd telnetd //コメントアウトを外す *各種アップデート [#h422ef0e] **portsnap [#lb91f246] -設定 /etc/portsnap.conf //#cp portsnap.conf portsnap.conf.sample # REFUSE arabic chinese french german hebrew hungarian japanese //#外す、japanese消す # REFUSE korean polish portuguese russian ukrainian vietnamese //#外す -ポートツリーを最新にする。 #portsnap fetch #portsnap extract #portsnap update 二回目以降はextractは不要。下記のように&&でまとめることも可能。 #portsnap fetch && portsnap update など。 **freebsd-update [#rbee4a14] -現在のバージョンを確認する。 #uname -a -FreeBSD(OS)を最新にする。 #freebsd-update fetch #freebsd-update install no needsが出たら終了。 **portupgrade [#m1d73d1a] -インストール /usr/ports/ports-mgmt/portupgrade #make install clean -パッケージデータベース不整合の修正 #pkgdb -F -パッケージのバージョンを見る #pkg_version | grep "<" <と表示されていれば新しいバージョンがある。 -アップグレード #portupgrade パッケージ名 #portupgrade -a //新しいパッケージがある場合は対象を全てアップグレードする。 *FTP [#f2e1210a] /etc/rc.conf +ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l //コメントアウトを外す 一応繋がる。 *NTP [#u368e4a8] /etc/rc.conf +ntpd_enable="YES" 同期の確認 #ntpq -p *httpd(apache22) [#sa8ff9aa] -インストール /usr/ports/www/apache22/ #make install clean //適宜OKボタン -自動起動 /etc/rc.conf apache22_enable="YES" apache22ssl_enable="YES" -エラー [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter -対処方法 #kldload accf_http.ko /boot/loader.conf +accf_http_load="YES" -http://www.skymerica.com/blog/yotsumoto/arch/2007/06/11/000799.html -http://d.hatena.ne.jp/nyamix/20080608/1213015876 *日本語マニュアル [#fe418687] -インストール /usr/ports/japanese/man/ #make install clean -日本語環境 /usr/home/admin/.login_conf me:\ :charset=UTF-8:\ :lang=ja_JP.UTF-8: /etc/login.conf japanese:Japanese Users Accounts:\ :charset=UTF-8:\ :lang=ja_JP.UTF-8:\ :tc=default #chsh ユーザ名 Class: japanese //classにjapaneseを追加。 /usr/home/admin/.bashrc +LC_CTYPE=ja_JP.UTF-8 +LANG=ja_JP.UTF-8 +esac +export LC_CTYPE +export LANG /usr/home/admin/.profile if [ -n "$BASH_VERSION" ]; then if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi 結局動かないし、その上不具合っぽくあちこちにガタがきてるというオチ。再インストールかしらー。 *Samba36 [#u04149ba] /usr/local/etc/pkgtools.conf MAKE_ARGS = { + 'converters/libiconv' => 'WITH_EXTRA_PATCHES=yes', } /usr/ports/converters/libiconv #make install clean //WITH_EXTRA_PATCHES=yesを追加してもよい #iconv -l | grep MS EUCJP-MS //が追加されるらしいがされなかった。 -インストール // Samba Ver.3.6.7 /usr/ports/net/samba36 #make install clean // MULTIBYTE=YES にする必要があるかも。 @CUPSのチェック外す。プリンタは使わないし。 /etc/rc.conf +samba_enable="YES" +winbindd_enable="YES" 再起動、または/usr/local/etc/rc.d/samba start -設定ファイル /usr/local/etc/smb.conf +display charset = CP932 +unix charset = EUC-JP-MS +dos charset = CP932 -共有フォルダ作成 #mkdir -p /usr/home/admin/public #chown root:nobody /usr/home/admin/public #chmod 777 /usr/home/admin/public /usr/local/etc/smb.confに以下を追加。 [globals] workgroup = workgroup netbios name = SMBSERVER server string = Samba %v security = User [homes] comment = %S's Home Directories writeable = yes browseable = no [public] path = /usr/local/samba/public public = yes only guest = yes writable = yes printable = no -ユーザー追加 #smbpasswd -x admin -ユーザの一覧 #pdbedit -L // IP:"219.212.46.58" TIME:"2014-03-17(<abbr class="week_day" title="月曜日">月</abbr>)23:16:36" REFERER:"http://157.7.130.26/" USER_AGENT:"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36