小编Ini*_*hib的帖子

是否可以快速拥有一个共享库?

今天我正在试验这个。我决定拍一张我的图书馆。我的 snapcraft.yaml 看起来像这样:

name: inverse
version: "4.1"
summary: [insert summary here]
descrption: [insert short desc here]
  [insert long desc here]
confinement: devmode

parts:
  inverse:
    plugin: cmake
    source: https://github.com/InitializeSahib/Inverse/archive/v4.1.tar.gz
Run Code Online (Sandbox Code Playgroud)

我用 来创建档案snapcraft,然后用 安装它sudo snap install --devmode inverse_4.1_amd64.snap
问题是,我不能用
经过基本检查,我得出了以下结论:

/snap (contains the inverse snap [headers and shared objects])
/usr/local/lib, /lib, /usr/lib (nothing in here)
/usr/local/include, /usr/include (nothing in here either)
Run Code Online (Sandbox Code Playgroud)

毫不奇怪,当我尝试使用它时会g++ 失败

g++: fatal error: inverse/InverseRandom.h: no such file or directory
g++: …
Run Code Online (Sandbox Code Playgroud)

shared-library c++ 16.04 snap

6
推荐指数
1
解决办法
909
查看次数

只允许系统上的一个用户通过 SSH 连接

我的服务器上有两个用户,myuser并且otheruser.
我希望人们只能通过 ssh 进入otheruser,而不能myuser.
我已经openssh-server安装了,22端口转发。

当我运行时:

$ ssh otheruser@127.0.0.1
Run Code Online (Sandbox Code Playgroud)

但是,如果我运行,它会起作用:

$ ssh myuser@127.0.0.1
Run Code Online (Sandbox Code Playgroud)

它仍然有效。

但是,我不希望它起作用。
我要添加什么才能sshd_config使它只接受一个用户?

server ssh users port-forwarding 16.04

3
推荐指数
1
解决办法
1万
查看次数

~/.bashrc 中的脚本在手动执行时有效,但在其他情况下无效

这很奇怪。
所以我开发了这个叫做的东西SahibLib,它基本上是一个脚本,你可以从中获取大量其他脚本。

它的目录树如下所示:

/home
    |- /home/myuser
       |- /home/myuser/sahiblib
          |- sahibload <- executed in ~/.bashrc
          |- sahiblib <- executed by sahibload
          |- modules
             |- core.sls <- problem file
             |- example.sls <- problem file
Run Code Online (Sandbox Code Playgroud)

SahibLib应该做的是获取.sls文件。但它不会那样做。

它输出正确的消息(“[SUCCESS]Thank you and goodbye.”),但实际文件没有来源。

myuser@mypc:~$ slhelp
Invalid command.
Run Code Online (Sandbox Code Playgroud)

奇怪的是,当我手动获取文件时,它可以工作:

myuser@mypc:~$ . ~/.bashrc
[SUCCESS] Thank you and goodbye.
myuser@mypc:~$ slhelp
SahibLib Core Help
...
Run Code Online (Sandbox Code Playgroud)

我的问题是,为什么脚本没有在 ~/.bashrc 中正确执行


更新:向 写入一些调试命令core.sls,该文件似乎完美执行。它到达文件的末尾,并返回一个标准的退出代码。这让问题变得更加奇怪,因为现在看来 Bash 只是完全忽略了函数定义。此外,如果您需要查看core.sls或任何文件,可 …

command-line bash scripts bashrc source

2
推荐指数
1
解决办法
339
查看次数