小编Ben*_*ess的帖子

/etc/sudoers.d 中的 Sudo 指令不起作用(但如果它在 /etc/sudoers 中就好了)

我希望向/etc/sudoers.d包含指令的文件夹添加一个文件,以允许www-data在没有 root 密码的情况下运行一个特定的脚本。

该指令是

www-data ALL=(ALL) NOPASSWD: /path/to/script.sh
Run Code Online (Sandbox Code Playgroud)

如果我visudo将其添加到 中/etc/sudoers,则没有问题。

如果我将该行放在一个文件中并将其复制到/etc/sudoers.d, 那么visudo它会告诉我该文件在第 1 行附近有一个“语法错误”。

我还需要在文件中放入其他东西,或者我需要做些什么才能使其工作?

我正在运行 Ubuntu 18。

谢谢!

sudo ubuntu-18.04

16
推荐指数
1
解决办法
3255
查看次数

通过 Internet 挂载文件系统

我为我的一位客户构建了一个在虚拟服务器上运行的 Web 应用程序。它包括供他们上传文件的工具,但他们现在希望将这些文件存储在他们办公室的服务器上。

最简单的方法是将他们的文件系统通过互联网直接挂载到虚拟服务器上。我有通过内部网络安装 NFS 的经验,但我不清楚它是否适用于这种情况。

有什么想法吗?我总是可以编写新软件来传输文件,但这很容易解决!

注:办公室的服务器是运行在windows hyper-v环境下的虚拟服务器上的Ubuntu 12服务器。带有网络应用程序的 VPS 是 Ubuntu 11.04

linux filesystems internet nfs

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

是否可以在使用 haproxy 检查 SSL 之前重定向 https 连接?

我有两个域,myexample.commy-example.com. 我希望任一域的所有流量都转到https://www.my-example.com,我有 SSL 证书。我没有域 myexample.com 的 SSL 证书。

我有http://myexample.comhttp://www.myexample.comhttp://my-example.comhttp://www.my-example.com都重定向到https://www 。 my-example.com没有问题,但是当我为https://myexample.comhttps://www.myexample.com设置重定向时,它会在重定向之前检查它们的 SSL 证书,因此我总是会获得证书错误。

有没有办法在没有 SSL 检查我重定向的非 SSL 域的情况下进行重定向?

我的配置文件的相关部分:

frontend www-https
   bind xxx.xxx.xxx.xxx:443 ssl crt /etc/ssl/private/www.my-example.com.pem
   reqadd X-Forwarded-Proto:\ https
   redirect prefix https://www.my-example.com code 301 if { hdr(host) -i myexample.com }
   redirect prefix https://www.my-example.com code 301 if { hdr(host) -i www.myexample.com }
   default_backend www-backend
Run Code Online (Sandbox Code Playgroud)

ssl haproxy

11
推荐指数
1
解决办法
3280
查看次数

Certbot 因 AttributeError 失败:'module' 对象没有属性 'Locale'

几个月前我设置了一个新服务器,运行 Ubuntu 18.04 LTS。我成功安装了 certbot 并使用 cloudflare DNS 插件创建了我的证书。

现在是更新的时候了,但是当我运行certbot renew(或其他各种 certbot 命令)时,我收到以下错误

# certbot renew
/usr/local/lib/python2.7/dist-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
  CryptographyDeprecationWarning,
Traceback (most recent call last):
  File "/usr/local/bin/certbot", line 7, in <module>
    from certbot.main import main
  File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 2, in <module>
    from certbot._internal import main as internal_main
  File "/usr/local/lib/python2.7/dist-packages/certbot/_internal/main.py", line 21, in …
Run Code Online (Sandbox Code Playgroud)

ubuntu python certbot

7
推荐指数
1
解决办法
1901
查看次数

PHP 7.2 无法读取会话数据:memcache

我正在将一些服务器从 Ubuntu 16 迁移到 Ubuntu 18,但我无法让 php 会话和 memcache 正常工作。

在当前 (Ubuntu 16) 设置中,有三台服务器使用 memcache(注意:不是 memcached!)共享会话。

我相信我已经在新服务器上复制了当前设置,但它不起作用,我在 apache 错误日志中收到以下错误:

PHP Warning:  session_start(): Failed to read session data: memcache (path: tcp://10.32.82.6:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15,tcp://10.32.82.7:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15,tcp://10.32.82.8:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15)
Run Code Online (Sandbox Code Playgroud)

phpinfo()我看到session.save_pathsession.save_handler设置正确(如上面的日志消息所示)。

如果我去三台机器中的任何一台,我都可以远程登录到任何其他服务器上的端口 11211。

如果我查看日志(设置为 -vv),我可以看到正在发生的事情和相当多的“NOT_FOUND”语句,但我真的不知道如何解释这些日志。

/etc/php/7.2/mods-available/memcache.ini

memcache.allow_failover="1"
memcache.max_failover_attempts="4"
memcache.session_redundancy="4"
Run Code Online (Sandbox Code Playgroud)

在当前(Ubuntu 16)设置中,我记得尝试过 memcached 和 memcache 并确定 memcache 是正确的解决方案。在新设置上尝试 memcached 是我最后的手段,因为我觉得 memcache应该可以工作,而我只是遗漏了一些东西,或者我不知道 Ubuntu 18 中发生了一些变化。

php memcache session

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

标签 统计

certbot ×1

filesystems ×1

haproxy ×1

internet ×1

linux ×1

memcache ×1

nfs ×1

php ×1

python ×1

session ×1

ssl ×1

sudo ×1

ubuntu ×1

ubuntu-18.04 ×1