GNOME のディレクトリ名を日本語から英語に直す

RedHad 系(RHEL, Fedora, CentOS)、 Ubuntu であろうがなかろうが GTK 使ってるディスプレイマネージャはこの方法で修正できる。

LANG=C xdg-user-dirs-gtk-update


ホームディレクトリのフォルダ名を日本語から英語に変更するには - @IT

Ubuntu Server 14.04 LTS から 16.04 LTS にアップグレードした

最初はプレーンな Jenkins しか入っていないからクリーンインストールしたかったんだけど、
サーバマシンが古すぎるからなのか 16.04 のインストールイメージは NIC を認識しない。


$ sudo apt-get install update-manager-core


sudo vim /etc/update-manager/release-upgrades

Prompt=normal にする必要がある。

# Default behavior for the release upgrader.

# Default prompting behavior, valid options:
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
wnoguchi@phy2:~$ sudo do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [198 B]
Get:2 Upgrade tool [1230 kB]
Fetched 1230 kB in 0s (0 B/s)
authenticate 'wily.tar.gz' against 'wily.tar.gz.gpg'
extracting 'wily.tar.gz'
[screen is terminating]

Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
Do you want to continue?

Continue [yN] N
=== Command terminated with exit status 1 (Thu May  5 13:20:06 2016) ===

まあ、 screen が立ち上がっているようなので、大丈夫みたいだが。

Ign trusty/main Translation-en_US
Ign trusty/multiverse Translation-en_US
Ign trusty/restricted Translation-en_US
Ign trusty/universe Translation-en_US
Fetched 5,083 kB in 6s (13.6 MB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done

Updating repository information

Third party sources disabled

Some third party entries in your sources.list were disabled. You can
re-enable them after the upgrade with the 'software-properties' tool
or your package manager.

To continue please press [ENTER]


Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done

Calculating the changes

Calculating the changes

Do you want to start the upgrade?

1 installed package is no longer supported by Canonical. You can
still get support from the community.

6 packages are going to be removed. 131 new packages are going to be
installed. 411 packages are going to be upgraded.

You have to download a total of 317 M. This download will take about
3 minutes with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d]y


「libpam, libc, libssl とかのパッケージのインストール中はいくつかのサービスをリスタートする必要があるけど、なんにも聞かずにリスタートしてもいい?」と聞かれる。

 ┌────────────┤ Configuring libc6 ├──────────────┐
 │                                                                           │
 │ There are services installed on your system which need to be restarted    │
 │ when certain libraries, such as libpam, libc, and libssl, are upgraded.   │
 │ Since these restarts may cause interruptions of service for the system,   │
 │ you will normally be prompted on each upgrade for the list of services    │
 │ you wish to restart.  You can choose this option to avoid being           │
 │ prompted; instead, all necessary restarts will be done for you            │
 │ automatically so you can avoid being asked questions on each library      │
 │ upgrade.                                                                  │
 │                                                                           │
 │ Restart services during package upgrades without asking?                  │
 │                                                                           │
 │                    <Yes>                       <No>                       │
 │                                                                           │

Unpacking psmisc (22.21-2build1) over (22.20-1ubuntu2) ...
Preparing to unpack .../ubuntu-release-upgrader-core_1%3a15.10.14.4_all.deb ...
Unpacking ubuntu-release-upgrader-core (1: over (1:0.220.8) ...
Preparing to unpack .../python3-distupgrade_1%3a15.10.14.4_all.deb ...
Unpacking python3-distupgrade (1: over (1:0.220.8) ...
Preparing to unpack .../python3-update-manager_1%3a15.10.3_all.deb ...
Unpacking python3-update-manager (1:15.10.3) over (1:0.196.14) ...
Preparing to unpack .../update-manager-core_1%3a15.10.3_all.deb ...
Unpacking update-manager-core (1:15.10.3) over (1:0.196.14) ...
Preparing to unpack .../python3-gi_3.16.2-1build1_amd64.deb ...
Unpacking python3-gi (3.16.2-1build1) over (3.12.0-1ubuntu1) ...
Preparing to unpack .../rsync_3.1.1-3ubuntu0.15.10.1_amd64.deb ...
Unpacking rsync (3.1.1-3ubuntu0.15.10.1) over (3.1.0-2ubuntu0.2) ...
Preparing to unpack .../shared-mime-info_1.3-1_amd64.deb ...
Unpacking shared-mime-info (1.3-1) over (1.2-0ubuntu3) ...
Preparing to unpack .../tcpdump_4.7.4-1ubuntu1_amd64.deb ...


Setting up command-not-found (0.3ubuntu15.10.1) ...
Installing new version of config file /etc/zsh_command_not_found ...
Setting up plymouth-theme-ubuntu-text (0.9.0-0ubuntu9) ...
update-initramfs: deferring update (trigger activated)
Setting up python3-distupgrade (1: ...
Setting up python3-update-manager (1:15.10.3) ...
Setting up ubuntu-release-upgrader-core (1: ...

Configuration file '/etc/update-manager/release-upgrades'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** release-upgrades (Y/I/N/O/D/Z) [default=N] ?N

LTS から変えたくないので N と答える。

Remove obsolete packages?

25 packages are going to be removed.

 Continue [yN]  Details [d]y
Fetched 0 B in 0s (0 B/s)


Processing triggers for man-db (2.7.4-1) ...
Processing triggers for libc-bin (2.21-0ubuntu4.1) ...

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

なんか途中で 15.10 とかプロンプト出たんだけど大丈夫かな、心配だなあ・・・・。
16.04 にしたかったんだけど・・・。

➜  ~ ssh phy2
Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-35-generic x86_64)

 * Documentation:

  System information as of Thu May  5 14:40:07 JST 2016

  System load:  1.76             Processes:           174
  Usage of /:   8.0% of 1.78TB   Users logged in:     0
  Memory usage: 5%               IP address for eth0:
  Swap usage:   0%               IP address for p7p1:

  Graph this data and manage this system at:

Last login: Thu May  5 13:22:30 2016
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.


Normal なの確認してもう一発あげる。

wnoguchi@phy2:~$ sudo vim /etc/update-manager/release-upgrades
wnoguchi@phy2:~$ sudo do-release-upgrade


Mac OS X のスクリーンショット保存場所&ファイル名を変更する

Mac に標準で実装されているスクリーンショットには 2 点不満があった。

  1. スクリーンショットがデスクトップに保存される。
  2. スクリーンショットが日本語名で保存される。

この 2 点を解消する。
標準でも iTerm2 でもいいのでターミナルを立ち上げてやります。


これは Dropbox とか ownCloud のフォルダに保存して欲しかったので真っ先に変えた。

defaults write location ~/Dropbox/
killall SystemUIServer



スクリーンショット 2016-04-01 22.49.28.png


defaults write name "ScreenShot"
killall SystemUIServer


ScreenShot 2016-05-05 14.19.30.png


Samba ファイルサーバーの構築 (CnetOS7.2)

認証無しで共有サーバーに書き込めるのがいいと思っていたけど、しゃべる NetBIOS のプロトコルのバージョンが下がって遅くなるんだよね。
なので pdbedit で認証されているユーザじゃないと書き込めないようになっています。
ちなみに Samba のバージョンは 4 系なので Active Directory ドメインコントローラとして動作させようと思えば構築できる。

[root@phy3 samba]# yum info samba
名前                : samba
アーキテクチャー    : x86_64
バージョン          : 4.2.10
リリース            : 6.el7_2
容量                : 1.8 M
リポジトリー        : installed
提供元リポジトリー  : updates
要約                : Server and Client software to interoperate with Windows machines
URL                 :
ライセンス          : GPLv3+ and LGPLv3+
説明                : Samba is the standard Windows interoperability suite of programs for Linux and Unix.

Samba のインストール

sudo yum -y install samba
sudo mkdir /var/samba


mkdir ~/samba



sudo pdbedit -a wnoguchi
new password:
retype new password:
Unix username:        wnoguchi
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-3726826207-3823386518-2277225043-1000
Primary Group SID:    S-1-5-21-3726826207-3823386518-2277225043-513
Full Name:            Wataru Noguchi
Home Directory:       \\phy3\wnoguchi
HomeDir Drive:
Logon Script:
Profile Path:         \\phy3\wnoguchi\profile
Domain:               PHY3
Account desc:
Munged dial:
Logon time:           0
Logoff time:          木, 07  2月 2036 00:06:39 JST
Kickoff time:         木, 07  2月 2036 00:06:39 JST
Password last set:    水, 04  5月 2016 10:11:26 JST
Password can change:  水, 04  5月 2016 10:11:26 JST
Password must change: never
Last bad password   : 0
Bad password count  : 0



sudo chown nobody:nobody /var/samba

Samba の設定

  • 設定ファイルバックアップ
sudo cp -rp /etc/samba{,.orig}
  • /etc/samba/smb.conf
unix charset = UTF-8
dos charset = CP932

workgroup = MYGROUP
workgroup = PG1X


;    hosts allow = 127. 192.168.12. 192.168.13.
    hosts allow = 127. 172.16. 172.17. 172.18.

    load printers = yes
    disable spoolss = yes

    comment = Home Directories
    path = %H/samba

    vfs objects = recycle
    recycle:repository = .recycle
    recycle:keeptree = no
    recycle:versions = yes
    recycle:touch = no
    recycle:maxsize = 0
    recycle:exclude = *.tmp ~$*

    comment = Public Stuff
    path = /var/samba
    public = yes
    writable = yes
    only guest = yes
    vfs objects = recycle
    recycle:repository = .recycle
    recycle:keeptree = no
    recycle:versions = yes
    recycle:touch = no
    recycle:maxsize = 0
    recycle:exclude = *.tmp ~$*

smb, nmb 起動

sudo systemctl start smb
sudo systemctl start nmb
sudo systemctl enable smb
sudo systemctl enable nmb


1ヶ月間 = 30 日 = 30 * 24 時間 = 720 時間 アクセスのないものは完全に削除する

sudo cat <<'EOF' >/etc/cron.weekly/recyclewatch
for user in `ls /home/`
  if [ -d /home/$user/.recycle ]; then
    tmpwatch -f 720 /home/$user/.recycle/
if [ -d /var/samba/.recycle ]; then
  tmpwatch -f 720 /var/samba/.recycle/
sudo chmod 744 /etc/cron.weekly/recyclewatch


sudo firewall-cmd --permanent --zone=public --add-service=samba
sudo firewall-cmd --reload



Windows の場合


Mac, Linux の場合




[root@phy3 samba]# tailf /var/log/samba/log.macbookair-d7e0
[2016/05/04 11:00:01.995083,  0] ../source3/smbd/service.c:798(make_connection_snum)
  canonicalize_connect_path failed for service public, path /home/samba
[2016/05/04 11:00:01.997818,  0] ../source3/smbd/service.c:798(make_connection_snum)
  canonicalize_connect_path failed for service public, path /home/samba
[2016/05/04 11:01:04.905785,  0] ../source3/smbd/service.c:798(make_connection_snum)
  canonicalize_connect_path failed for service public, path /home/samba

Oops… 書き間違い。

    comment = Public Stuff
    path = /home/samba
    comment = Public Stuff
    path = /var/samba


sudo systemctl restart smb
sudo systemctl restart nmb


  1. Windowsファイルサーバー構築(Samba) – CentOSで自宅サーバー構築
  2. CentOS7にSambaをインストール | 俺的備忘録 〜なんかいろいろ〜