Windows コマンドプロンプトで whois

Windowsコマンドプロンプトwhoisが引けるとありがたいので調べたところ、Microsoftオフィシャルのwhoisがあった!

全く知らなかった。

technet.microsoft.com

ダウンロードしてPATHが通った適当なフォルダにコピーして使うことにする。

いや。

便利。

シンプルなwhoisコマンドです。

Mac で Vagrant

急にLinux環境が必要になったのでせっかくだからVagrantで用意してみようかというメモ。

環境

Vagrant のインストール

Vagrant サイトから Mac OS X 用の dmg ファイルをダウンロードしてインストールする。

www.vagrantup.com

バージョン確認vagrant -vをしてインストールが完了したことを確認する。

$ vagrant -v
Vagrant 1.8.1

CentOS のBOXをインストール

事前に VirtualBox が必要となるので dmg ファイルをダウンロードしてインストールしておく。

Oracle VM VirtualBox - Downloads | Oracle Technology Network | Oracle

BOXは

A list of base boxes for Vagrant - Vagrantbox.es

にて提供されているCentOSVagrantコマンドvagrant box add {title} {URL}でインストールする。

$ vagrant box add centos71 https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'centos71' (v0) for provider: 
    box: Downloading: https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box
==> box: Successfully added box 'centos71' (v0) for 'virtualbox'!

インストールしたBOXをVagrantコマンドvagrant box listで確認する。

$ vagrant box list
centos71 (virtualbox, 0)

インストールしたBOXをディレクトリcentos71作成して、Vagrantコマンドvagrant initでそのディレクトリに初期化する。

$ mkdir centos71
$ cd centos71/
$ vagrant init centos71
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

初期化したBOXをVagrantコマンドvagrant upで起動する。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos71'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: centos71_default_1462176011682_74019
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.30
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => /Users/tokunaga.keita/centos71

起動したVagrantBOXの状態をVagrantコマンドvagrant statusで確認する。

$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

起動が確認できたのでVagrantコマンドvagrant sshで接続してみる。

$ vagrant ssh

Linuxでのユーザ編集のメモ

Linuxに稀にログインして作業するのですが更に稀にログインユーザの編集を行います。

稀の稀なので忘れます。

メモを残しておけばいいのですけど。。。

というわけでメモです。

やれる事は色々あるのですが、やる事は限られています。

1. ユーザを追加する

$ sudo /usr/sbin/useradd -u [UID] -g [GID] [user] 
オプション 内容
-u [UID] user ID of the new account
-g [GID] name or ID of the primary group of the new
[user] 追加対象のユーザ名

2. ユーザを削除する

$ sudo /usr/sbin/userdel -r [user]
オプション 内容
-r remove home directory and mail spool
[user] 削除対象のユーザ名

3.グループにユーザを追加する

$ sudo /usr/sbin/usermod -a -G [group] [user]
オプション 内容
-a ユーザを (-G で指定された) 補助グループ群GROUPS に追加する。他のグループからの削除は行わない。
-G [group] 新たな補助グループのリストを与える
[user] 対象のユーザ名

4. グループからユーザを削除する

$ sudo /usr/sbin/groupmems -d [user] -g [group]
オプション 内容
-d [user] ユーザをグループのメンバーから除く
-g [group] 対象のグループ名

5. グループのメンバーリストを参照する

$ sudo /usr/sbin/groupmems -l -g [group]
オプション 内容
-l グループのメンバー一覧を表示する
-g [group] 対象のグループ名