AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-124191

Black's questions

Martin Hope
Black
Asked: 2023-06-30 15:53:56 +0800 CST

ACL 未应用默认组

  • 6

我希望目录/var/www/company及其所有子目录中的所有新文件/文件夹都具有用户company和组www-data。

所以我像这样设置我的 ACL:

$ getfacl /var/www/company/
getfacl: Removing leading '/' from absolute path names
# file: var/www/company/
# owner: company
# group: www-data
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:company:rwx
default:group::r-x
default:group:www-data:rwx
default:mask::rwx
default:other::r-x

但是,如果我创建一个新文件,例如touch foo,则用户和组都设置为company:

-rw-rw-r--+ 1 公司 公司 0 Jun 30 09:52 foo


$ getfacl foo
# file: foo
# owner: company
# group: company
user::rw-
user:company:rwx            #effective:rw-
group::r-x          #effective:r--
group:www-data:rwx      #effective:rw-
mask::rw-
other::r--

$ id company
uid=1000(company) gid=33(www-data) groups=33(www-data),27(sudo)
linux
  • 2 个回答
  • 25 Views
Martin Hope
Black
Asked: 2023-05-10 14:37:51 +0800 CST

Ubuntu - 始终对特定目录使用特定的 php 版本

  • 5

我有多个 PHP(8.1 和 7.3)。如果我执行,php -v那么我得到 7.3。

我需要用 PHP 为 magento 2 执行一些命令,例如,但我需要用 php 8.1 为某个文件夹( /var/www/companyphp bin/magento cache:flush )调用它,但我不想总是必须指定我的 php 8 二进制文件,例如让它工作。php8.1 bin/magento cache:flush

如果我在那个特定目录中,有没有办法让它始终使用 PHP 8.1?

linux
  • 1 个回答
  • 16 Views
Martin Hope
Black
Asked: 2023-03-03 21:04:22 +0800 CST

获取所有文件和目录的列表及其权限和所有者

  • 5

我需要在他们的许可和所有者的情况下生成所有文件和目录的列表,例如

-rw-rw-r--    black www-data     foo/
-rw-r--r--    black www-data     foo/foo.txt
-rw-rw-r--    black www-data     bar/
-rwxrwxr-x    black www-data     bar/foo.sh

我需要这个列表来将它与我有错误的另一个实例进行比较。

files
  • 5 个回答
  • 40 Views
Martin Hope
Black
Asked: 2022-12-10 01:24:31 +0800 CST

授予用户 A 对用户 B 的完全访问权限,反之亦然

  • 5

我有两个用户。每个用户都有一个项目。

问题:

我需要同时处理这两个项目,但我总是必须登录另一个用户才能进行更改,否则我没有权限。

我已将该项目拆分给两个用户,因为我需要为这两个用户设置另一组别名。这两个项目都使用不同的 PHP 版本运行,别名需要引用正确的版本。别名用于项目特定的 CLI 命令。

题:

有没有办法让用户 A 拥有对用户 B 的完全访问权限,反之亦然?

permissions
  • 1 个回答
  • 31 Views
Martin Hope
Black
Asked: 2022-09-21 01:19:33 +0800 CST

CA 捆绑包中是否包含私钥?

  • 0

您可以在下面从我们的一个域中看到我的 apache2 虚拟主机 SSL 配置,效果很好:

    ...

    # Example SSL configuration
    SSLEngine on
    #SSLProtocol all -SSLv2
    #SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
    SSLCertificateFile "/etc/ssl/certs/company/cert"
    SSLCertificateKeyFile "/etc/ssl/certs/company/key"
    SSLCertificateChainFile "/etc/ssl/certs/company/ca-bundle"

    ...

我需要升级另一个网站以使其使用 SSL。

但是我们的IT部门只给了我cert和ca-bundle,他们说私钥包含在ca-bundle

所以我试图省略“SSLCertificateKeyFile”,但它仍然不能以这种方式工作。

那么私钥真的包含在 CA 包中吗?

我读过它可以包含在证书本身中,但非常不鼓励这样做。

“最后,终端实体证书的私钥也可以添加到证书文件中,而不是使用单独的 SSLCertificateKeyFile 指令。这种做法是非常不鼓励的。如果使用它,则必须在证书之后配置使用这种嵌入密钥的证书文件“

文档

openssl certificates
  • 1 个回答
  • 31 Views
Martin Hope
Black
Asked: 2022-06-08 23:34:02 +0800 CST

从 update-alternatives 命令更改未生效

  • 0

我尝试使用以下命令更改我的 PHP CLI 版本sudo update-alternatives --config php:

There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.1      81        auto mode
* 1            /usr/bin/php8.0.15   1         manual mode
  2            /usr/bin/php8.1      81        manual mode

我将其设置为 0 并检查它update-alternatives --display php:

php - auto mode
  link best version is /usr/bin/php8.1
  link currently points to /usr/bin/php8.1
  link php is /usr/bin/php
  slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php8.0.15 - priority 1
/usr/bin/php8.1 - priority 81
  slave php.1.gz: /usr/share/man/man1/php8.1.1.gz

看起来它有效,但如果我检查它,php -v我会得到:

PHP 8.0.15 (cli) (built: Jun  7 2022 10:21:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.15, Copyright (c) Zend Technologies

command -v php输出/usr/local/bin/php。


我正在使用 Ubuntu 22.04 LTS

linux ubuntu
  • 1 个回答
  • 317 Views
Martin Hope
Black
Asked: 2021-12-30 02:22:16 +0800 CST

Linux - 让用户在没有日志文件文件夹权限的情况下访问日志文件?[复制]

  • 2
这个问题在这里已经有了答案:
访问子目录时,父目录的权限是否重要? (4 个回答)
10 个月前关闭。

我的 apache 服务器将我的项目的日志文件放在

/var/log/apache2/foo_error.log

我将用户和组设置为我的项目(foo:www-data),我什至尝试将 chmod 设置为 777(我知道这是一个风险,但它只是一个本地 VM),但如果我尝试访问它,然后我仍然得到Permission Denied

tail -f /var/log/apache2/foo_error.log
tail: cannot open '/var/log/apache2/foo_error.log' for reading: Permission denied
tail: no files remaining

我想出的唯一解决方案是更改 VHOST 配置,以便将日志文件保存在项目的文件夹中。但是如果日志文件位于 apache2 日志文件夹中,它是否也可以工作,我出于兴趣问这个问题。

linux permissions
  • 1 个回答
  • 38 Views
Martin Hope
Black
Asked: 2021-10-10 00:23:06 +0800 CST

Ubuntu - chmod g+s 不会使新文件继承组

  • -2

我用apache2安装了一个新的ubuntu。

我使用以下 user:group -> 创建了一个新文件夹“/var/www/foobar” black www-data。

我需要在此文件夹中创建新文件来继承该文件夹的用户和组。

所以我执行了chmod g+s /var/www/foobar

drwxr-xr-t  2 black www-data 4,0K Okt  9 10:12 foobar

但是,如果我在此文件夹中创建一个新文件,则用户和组将设置为black black而不是black www-data.

我也尝试将用户添加到组www-data中,sudo usermod -a -G www-data black但没有任何区别。

我错过了什么?

ubuntu permissions
  • 1 个回答
  • 359 Views
Martin Hope
Black
Asked: 2021-09-02 07:34:15 +0800 CST

如何获取某个 PHP 版本的 phpize?

  • 2

如果我跑步,phpize -v那么我会得到

Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

如果我打开 phpinfo 那么它会显示一个较新的日期

在此处输入图像描述

所以我的 phpize 已经过时了。


这是的输出php -v:

PHP 7.4.21 (cli) (built: Jul  1 2021 16:09:41) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

如果我创建一个 php 信息页面并显示它,那么它也会显示PHP版本 7.4.21

如何获得 phpize 的 php 7.4 ?

php
  • 1 个回答
  • 1030 Views
Martin Hope
Black
Asked: 2019-12-21 01:18:18 +0800 CST

openSUSE - 存储库 'XY' 无效 - 将存储库更改为从 Internet 加载,而不是从介质加载

  • 0

我尝试安装一些 PHP 模块:

zypper install php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-openssl php7.0-zip php7.0-soap

输出:

Failed to mount cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001 on /var/tmp/AP_0xgQO1rM: Mounting media failed (mount: /var/tmp/AP_0xgQO1rM: no medium found on /dev/sr0.)
Please insert medium [] #1 and type 'y' to continue or 'n' to cancel the operation. [yes/no] (no): no
Error building the cache:
[openSUSE-Leap-15.0-1|cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001] Valid metadata not found at specified URL
Warning: Skipping repository 'openSUSE-Leap-15.0-1' because of the above error.
Some of the repositories have not been refreshed because of an error.
Loading repository data...
Reading installed packages...
'php7.0-curl' not found in package names. Trying capabilities.
No provider of 'php7.0-curl' found.
'php7.0-gd' not found in package names. Trying capabilities.
No provider of 'php7.0-gd' found.
'php7.0-intl' not found in package names. Trying capabilities.
No provider of 'php7.0-intl' found.
'php7.0-mbstring' not found in package names. Trying capabilities.
No provider of 'php7.0-mbstring' found.
'php7.0-mcrypt' not found in package names. Trying capabilities.
No provider of 'php7.0-mcrypt' found.
'php7.0-openssl' not found in package names. Trying capabilities.
No provider of 'php7.0-openssl' found.
'php7.0-soap' not found in package names. Trying capabilities.
No provider of 'php7.0-soap' found.
'php7.0-xsl' not found in package names. Trying capabilities.
No provider of 'php7.0-xsl' found.
'php7.0-zip' not found in package names. Trying capabilities.
No provider of 'php7.0-zip' found.
Resolving package dependencies...

Nothing to do.

我认为我的存储库有问题。它尝试从磁盘(cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_100000000000000000001)而不是从 Internet 加载存储库。但是光盘不再插入,我不能,因为它是我公司的虚拟机,并且管理员正在休假。

zypper lr -uP:

#  | Alias                     | Name                                    | Enabled | GPG Check | Refresh | Priority | URI
---+---------------------------+-----------------------------------------+---------+-----------+---------+----------+---------------------------------------------------------------------------------------
 1 | openSUSE-Leap-15.0-1      | openSUSE-Leap-15.0-1                    | Yes     | ( p) Yes  | No      |   99     | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001
 2 | packman.inode.at-suse     | Packman Repository                      | Yes     | (r ) Yes  | Yes     |   99     | http://packman.inode.at/suse/openSUSE_Leap_15.0/
 3 | repo-debug                | openSUSE-Leap-15.0-Debug                | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/distribution/leap/15.0/repo/oss/
 4 | repo-debug-non-oss        | openSUSE-Leap-15.0-Debug-Non-Oss        | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/distribution/leap/15.0/repo/non-oss/
 5 | repo-debug-update         | openSUSE-Leap-15.0-Update-Debug         | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/update/leap/15.0/oss/
 6 | repo-debug-update-non-oss | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/update/leap/15.0/non-oss/
 7 | repo-non-oss              | openSUSE-Leap-15.0-Non-Oss              | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/distribution/leap/15.0/repo/non-oss/
 8 | repo-oss                  | openSUSE-Leap-15.0-Oss                  | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/distribution/leap/15.0/repo/oss/
 9 | repo-source               | openSUSE-Leap-15.0-Source               | No      | ----      | ----    |   99     | http://download.opensuse.org/source/distribution/leap/15.0/repo/oss/
10 | repo-source-non-oss       | openSUSE-Leap-15.0-Source-Non-Oss       | No      | ----      | ----    |   99     | http://download.opensuse.org/source/distribution/leap/15.0/repo/non-oss/
11 | repo-update               | openSUSE-Leap-15.0-Update               | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/update/leap/15.0/oss/
12 | repo-update-non-oss       | openSUSE-Leap-15.0-Update-Non-Oss       | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/update/leap/15.0/non-oss/

如何更改存储库以便从 Internet 加载?

我知道我可以使用 修改现有的 repo zypper modifyrepo,但是如何修改 URI 以及在哪里可以找到正确的 URI?

opensuse zypper
  • 2 个回答
  • 2092 Views
Martin Hope
Black
Asked: 2019-11-30 02:08:09 +0800 CST

如何更改用户组?

  • 5

我为 FTP 创建了一个新用户。

useradd -g www-data -d /srv/www/vhosts/project/ black

我犯了一个错误,我实际上需要用户在组中www。

如何更改组?

linux permissions
  • 1 个回答
  • 2358 Views
Martin Hope
Black
Asked: 2019-10-10 07:53:37 +0800 CST

未知的接口 eth0,即使 `ethtool eth0` 显示信息

  • 4

我在虚拟机 (VM) 上运行 kali linux。今天启动机器,发现eth0接口不见了。

所以我尝试ifup eth0启动它,但得到了输出:unknown interface eth0.

但是如果我执行ethtool eth0然后我得到这个输出:

Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown (auto)
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: no
linux
  • 2 个回答
  • 15482 Views
Martin Hope
Black
Asked: 2019-05-15 00:10:37 +0800 CST

grep - 只在结果中显示 X 字符

  • 0

有没有办法指示在X字符grep后削减结果?

例如,如果我执行grep -iR searchString,那么有时结果中有压缩的 javascript 文件,其中整个代码在一行中,这会“破坏”结果,因为有时我的终端要处理的内容太多,部分结果消失或我有滚动很多。

例如结果应该从...改变

123456789

...至...

1234

...如果我使用伪选项执行 grep --show-n-chars 4。

我在文档中进行了搜索,但找不到任何东西。

grep
  • 2 个回答
  • 790 Views
Martin Hope
Black
Asked: 2019-03-27 07:55:28 +0800 CST

如果已安装 PHP,请安装 php 扩展

  • 1

如果已经安装了 PHP 而无需重新构建 PHP,是否可以安装 php 扩展?我需要安装日历扩展,但我不喜欢构建 PHP,我只是安装了它,apt-get并没有从源代码构建它。

https://www.php.net/manual/en/calendar.installation.php

php calendar
  • 1 个回答
  • 2029 Views
Martin Hope
Black
Asked: 2019-02-16 00:54:54 +0800 CST

显示所有计划的 cron 作业

  • 2

如何列出所有计划运行的 cron 作业?我需要检查我的 cron 作业是否正常工作。

我猜他们甚至没有运行,因为我们的 Magento 不再发送任何订单确认电子邮件。

cron
  • 2 个回答
  • 5552 Views
Martin Hope
Black
Asked: 2018-07-11 06:12:40 +0800 CST

在哪里可以找到编译生成的 .so 文件?

  • 0

我只是按照官方网站上的说明编译了 xdebug。但是我在哪里可以找到生成的 .so 文件?

我在文件夹中找到了一个,./libs/xdebug.so在modules/xdebug.so.

问题

  • 我需要哪一个,官方网站上没有信息?
  • 为什么不只是一个名为result或类似的文件夹?
compiling compiler
  • 1 个回答
  • 157 Views
Martin Hope
Black
Asked: 2018-06-26 06:26:39 +0800 CST

-bash: /bin/cd: No such file or directory - cd 后自动执行 ls

  • 6

我不小心破坏了我的cd命令。

我试图在被调用ls后自动执行cd。

我发现一个帖子说我必须执行alias cd='/bin/cd && /bin/ls',但现在我得到-bash: /bin/cd: No such file or directory并且不能再更改目录了。

linux alias
  • 3 个回答
  • 5687 Views
Martin Hope
Black
Asked: 2018-06-22 03:59:14 +0800 CST

如何将文件夹的内容移动到当前文件夹?

  • 8

我有这个文件夹结构:

foo
`----> bar

如何提取barinto的内容foo?

mv -f bar/* .我从内部尝试过foo。

-f,--强制 | 覆盖前不要问

但我得到“无法移动bar/ajax到,foo/ajax因为目录不为空”

我该如何解决这个问题?

cp mv
  • 5 个回答
  • 21196 Views
Martin Hope
Black
Asked: 2018-06-08 01:19:15 +0800 CST

Git 从列表中取消隐藏所有文件

  • 1

我通过使用创建了一个列表

$ git stash show --name-only | grep -i "Kopie"

输出:

A - Kopie.txt
B - Kopie.txt

如何取消隐藏列表中的所有文件?


第一种方法:

$ git stash show --name-only | grep -i "Kopie" | xargs git checkout stash@{0} --

结果:

error: pathspec 'A' did not match any file(s) known to git.
error: pathspec '-' did not match any file(s) known to git.
error: pathspec 'Kopie.txt' did not match any file(s) known to git.
error: pathspec 'B' did not match any file(s) known to git.
error: pathspec '-' did not match any file(s) known to git.
error: pathspec 'Kopie.txt' did not match any file(s) known to git.
git xargs
  • 1 个回答
  • 199 Views
Martin Hope
Black
Asked: 2018-06-02 04:32:05 +0800 CST

xargs + chmod - 找不到文件或目录

  • 3

我正在尝试递归更改项目中所有文件和目录的权限。

我在 magento 论坛上发现一个帖子说我可以使用这些命令:

find ./ -type f | xargs chmod 644
find ./ -type d | xargs chmod 755
chmod -Rf 777 var
chmod -Rf 777 media

它为find ./ -type d | xargs chmod 755.

该命令find ./ -type f返回了很多文件,但chmod: access to 'fileXY.html' not possible: file or directory not found如果我执行find ./ -type f | xargs chmod 644.

我该如何解决这个问题?

PS:我知道他建议我的 var 和 media 文件夹使用 777 权限,这是一个安全隐患,但我们还应该使用什么?

find permissions
  • 2 个回答
  • 3475 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve