问题描述
NoMachine是一种远程桌面解决方案,在机器人开发中广为流行,主要用于PC无线调试工控机,主要优点是免费、全平台、延迟极低、只占用一个端口(4000)便于端口映射等等。
NoMachine的方便快捷给我了启发,想到可以把游戏本放到宿舍24h运行,外出去图书馆或者教室的时候只带轻薄本,用SSH写代码,需要GUI的时候开一个远程桌面岂不是美滋滋。
然而,在Windows中安装NoMachine时弹出了Cannot create the home directory for the nx user
的错误:
虽然这一错误并不影响控制其他机器的功能,但当机器本身作为受控端,被其他机器连接时就会出现session negotiation failed
的错误,从而导致其他机器无法控制本机。
解决方案
注:解决方案稍微有些麻烦,如果不想太折腾还是直接用Teamviewer吧…
Google后找到一篇帖子NoMachine Forums - First time connecting session negotiation failed error,当中提到:
It appears that ‘nx’ user doesn’t hold the privilege required for starting the nxnode process. In this case, most likely ‘Act as part of the operating system’ is missing. This is the list of all privileges needed by ‘nx’ account:
- Act as part of the operating system
- Log on as a service
- Adjust memory quotas for a process
- Replace a process level token
大意就是说NoMachine正常运行所需的虚拟用户nx
没有得到相应的权限,因此手动为其赋予权限即可。
导致这一问题的原因NoMachine的技术团队也没有在官方论坛上说清楚。
为了给用户分配权限需要用到Windows的管理工具本地安全策略(Local Security Policy)
,但这是Professional版的Windows才有的功能,家庭版不支持。因此,首先需要升级Windows到Professional,具体方法需百度(更换一个密钥重启一下就行)。
打开本地安全策略
后,在本地策略→用户权限分配
中为nx
分配上述缺失的权限即可:
中英文对照为:
Act as part of the operating system → 以操作系统方式执行
Log on as a service → 作为服务登录
Adjust memory quotas for a process → 为进程调整内存配额
Replace a process level token → 替换一个进程级令牌