# SoftEther VPN Server 帳號管理
公司 VPN 是自架的
使用的是 [SoftEther VPN](https://www.softether.org/)
支援多平台與加密連線方式
感覺管理上應該算是蠻方便的
最近因為原來的負責人員離職
所以有新進/離職人員的時候
需要新增/移除可以使用的 VPN 帳號
輪到自己上的時候才發現有問題 XD
原先的負責人員使用的是 Windows 筆電
使用上輕鬆愉快
但我使用的是 Mac 筆電
SoftEther VPN 的 client 在 Mac 上出的版本竟然已經無法使用了
本來想說要弄台 Windows 電腦來用了
不過在網路上搜尋一陣後發現
好像用指令也行
於是就省下了一台 Windwos 電腦 XD
因為這次是做管理
所以相關程式已經都安裝完了
要做管理的話
要先找到 `vpnserver` 資料夾裡面的 `vpncmd` 程式來執行
查到的資料顯示
大部份都在 `/usr/local/vpnserver/vpncmd`
但是我們公司的在 `/root/vpnserver/vpncmd`
所以輸入
```bash
$ /root/vpnserver/vpncmd
```
會看到管理選單
直接選 `1`
```bash
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.28 Build 9669 (English)
Compiled 2018/09/11 12:23:27 by yagi at pc33
Copyright (c) SoftEther VPN Project. All Rights Reserved.
By using vpncmd program, the following can be achieved.
1. Management of VPN Server or VPN Bridge
2. Management of VPN Client
3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)
Select 1, 2 or 3:
```
會看到要求輸入主機或IP
不理它直接按 `Enter` 就好
```bash
Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on.
By specifying according to the format 'host name:port number', you can also specify the port number.
(When the port number is unspecified, 443 is used.)
If nothing is input and the Enter key is pressed, the connection will be made to the port number 8888 of localhost (this computer).
Hostname of IP Address of Destination:
```
會看到要求輸入 Hub 名稱
輸入存在的 Hub 名稱後會直接進入該 Hub
如果不知道 Hub 名稱就 `Enter` 就好
(這邊也可能出現提示輸入密碼,這時輸入對應的密碼即可)
```bash
If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name.
If connecting by server admin mode, please press Enter without inputting anything.
Specify Virtual Hub Name:
```
進入後可以使用 `help` 來查詢可用指令
```bash
VPN Server> help
```
我這次進來是為了異動使用者
所以先嘗試列出所有使用者帳號
```bash
VPN Server> UserList
```
但是看到這訊息
表示我們必須先選擇 Hub 進入
```bash
UserList command - Get List of Users
Before executing this command, first select the Virtual Hub to manage using the Hub command.
```
所以先列出可選的 Hub
```bash
VPN Server> HubList
```
會列出先前建立過的可選 Hub
以這邊的範例來說
我的 Hub 就叫 VPN
```bash
HubList command - Get List of Virtual Hubs
Item |Value
------------------+-------------------
Virtual Hub Name |VPN
Status |Online
Type |Standalone
Users |10
Groups |0
Sessions |2
MAC Tables |1
IP Tables |2
Num Logins |11650
Last Login |2022-04-13 09:01:18
Last Communication|2022-04-13 09:35:30
Transfer Bytes |5,929,815,854,617
Transfer Packets |7,555,601,802
The command completed successfully.
```
所以指定我要選擇的 Hub
```bash
VPN Server> Hub VPN
```
會看到下面提示字元也增加了 Hub `VPN` 的提示
```bash
Hub command - Select Virtual Hub to Manage
The Virtual Hub "VPN" has been selected.
The command completed successfully.
VPN Server/VPN>
```
這時候再使用列出使用者的指令就不會出現錯誤了
```bash
VPN Server> UserList
```
之後
再自行使用新增/移除的指令
對使用者做操作即可
<br><br>
參考網站:https://syu65406.tw/blog/74/%E6%A8%B9%E6%A2%85%E6%B4%BEraspberry-pi-%E6%9E%B6%E8%A8%ADsoftether-vpn-server
###### tags: `Linux` `VPN` `SoftEther VPN`