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-1641481

stackbiz's questions

Martin Hope
stackbiz
Asked: 2025-04-04 16:22:41 +0800 CST

如何设置 gnome-terminal 在打开新选项卡时使用“bash”而不是“sh”

  • 5

我在Ubuntu 服务器gnome-terminal上安装并发现了这个问题。

当我使用“ File”->“ New Tab”打开新选项卡时,gnome-terminal 将打开一个新选项卡,然后我尝试source在“ ”后运行“ ”命令#:

# source
sh: 1: source: not found
# 

将会提示“ sh: 1: source: not found”。

因此,Ubuntu 服务器中的 gnome-terminal 将sh在新选项卡中运行。这将导致终端up中的箭头键问题sh:https://unix.stackexchange.com/questions/103608/is-there-any-reason-why-i-get-a-when-i-press-up-arrow-at-the-console-login-sc

我必须在“ bash”之后运行“ #”才能获得“ bash”终端,以修复“ up”箭头键问题:

# source
sh: 1: source: not found
# bash
root@test:~# source
bash: source: filename argument required
source: usage: source filename [arguments]
root@test:~# 

Ubuntu 桌面上的 gnome-terminalbash在新选项卡中总是使用“ ”。

如何设置 Ubuntu 服务器上的 gnome-terminal在点击“ ”->“ ”时使用“ bash”而不是“ ”?shFileNew Tab

gnome
  • 1 个回答
  • 32 Views
Martin Hope
stackbiz
Asked: 2025-01-14 21:10:58 +0800 CST

OpenVPN 未使用“--genkey --tls-crypt”生成密钥

  • 7

我希望“ --genkey --tls-crypt”将在“ /tmp/test.key”中生成一个密钥,但它不会将结果写入目标文件,而只会将结果打印到控制台。

以下是用于测试的“ --genkey --tls-crypt”和“ cat”:

# openvpn --genkey --tls-crypt /tmp/test.key
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
65bc8c4654ddd1e39c7b2fb1c5d7b6c7
b551e4f48a109efb3f142b442eb7c808
3428ffc3a41a4fa52464cc8556469c5f
69d0736db7f37c56788da8f3995399c9
8bd664f9e669683805591a9a8fa1b73e
42058e66695f6b735fc4a52dbf26b1db
386811f79c629864c7b7169625e8d75a
30be70f1578eaa1340828de4eb9e2b4f
68f5f276e451429fd706e54f08bc08d2
538c0c66590fb6b5204b9b6f78634f52
dac5be0c419996cccc2bc9add38b0e33
4891a1f11b772ec3a13aed5f0ba678d0
e7f3497b39c549c8cfddbf28205bf24f
a23c07b58109d8f0efe868e35be8b3da
c4f7073dc4031d7d600790c4370189b4
57d8453ed1f565764ef69aeea4f85039
-----END OpenVPN Static key V1-----

# cat /tmp/test.key
cat: /tmp/test.key: No such file or directory
# 

如何在 OpenVPN 中用“ /tmp/test.key”生成密钥“ --genkey --tls-crypt”?在 OpenVPN 中“ ”的正确使用方法是什么--genkey --tls-crypt?

server
  • 1 个回答
  • 63 Views
Martin Hope
stackbiz
Asked: 2025-01-08 19:43:48 +0800 CST

如何在 Ubuntu 上的 bash expect 中匹配“国家名称(2 个字母代码)[US]:”带或不带“-re”

  • 5

当 bash 脚本提示输入“ ”时,我想使用“ expect”自动输入“ ”键。<Enter>Country Name (2 letter code) [US]:

预期如下:

/usr/bin/expect << EOF
    set timeout -1
    
    spawn /bin/bash /path/to/generate_openssl_certificate.sh
    
    expect {
        "Country Name (2 letter code) [US]:" {send "\r" ; exp_continue}
    }
EOF

错误如下:

spawn /bin/bash /path/to/generate_openssl_certificate.sh
invalid command name "US"
    while executing
"US"
    invoked from within
"expect {
            "Country Name (2 letter code) [US]:" {send "\r" ; exp_continue}
        }"

当我尝试使用“ -re”匹配字符串时,它与字符串“ Country Name (2 letter code) [US]:”不匹配:

expect {
    -re "Country Name \(2 letter code\) \[US\]:" {send "\r" ; exp_continue}
}

这是输出,屏幕正在等待“ <Enter>”键继续:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:

Country Name (2 letter code) [US]:不使用“ ”,如何匹配“ -re”?如何使用“ Country Name (2 letter code) [US]:”匹配“ -re”?

bash
  • 1 个回答
  • 37 Views
Martin Hope
stackbiz
Asked: 2024-10-20 17:15:09 +0800 CST

如何使用正则表达式检查 bash 中允许的字符

  • 5

我只想用来regex检查三个允许的字符:“ [0-9]”和“ .”和“ /”。

注意:测试用例是一个ipv4/ipv6地址,但我不想检查范围内的数字[0-255],我只想检查输入变量中允许的字符。

我使用“ |”作为“ or”表达式,并将所有三个允许的字符与“ |”组合,最后+在最后添加“ ”,以确保输入变量中至少存在一个允许的字符。

以下是测试 bash 脚本:

test_ipv4_address="127.0.0.1/24"
test_wrong_ipv4_address="127.0.0.1#24"
test_ipv6_address="::1/128"

allowed_characters='([0-9]|\.|\/)+'

[[ "$test_ipv4_address" =~ $allowed_characters ]] && echo "yes, $test_ipv4_address is allowed"
[[ "$test_wrong_ipv4_address" =~ $allowed_characters ]] && echo "yes, $test_wrong_ipv4_address is allowed"
[[ "$test_ipv6_address" =~ $allowed_characters ]] && echo "yes, $test_ipv6_address is allowed"

输出如下:

yes, 127.0.0.1/24 is allowed
yes, 127.0.0.1#24 is allowed
yes, ::1/128 is allowed

预期输出如下:

yes, 127.0.0.1/24 is allowed

我的正则表达式有什么问题?如何修复?

command-line
  • 1 个回答
  • 39 Views
Martin Hope
stackbiz
Asked: 2024-07-21 18:50:50 +0800 CST

如何在 Bash shell 中设置默认前景色?

  • 7

我从 @user313992 的回答中找到了设置的默认背景颜色代码:

在类似 xterm 的终端仿真器上:

这会将背景设置为浅绿色,而无需清除屏幕:

printf %b '\e]11;#ccffcc\a'

可以。但是如何以类似的方式在 Bash shell 中设置默认前景色?例如:

printf %b '???(default_foreground_color)???'

\e]11;并且,在哪里可以找到有关背景颜色代码和???前景色相应代码的相关信息?

command-line
  • 1 个回答
  • 211 Views
Martin Hope
stackbiz
Asked: 2024-06-20 21:06:03 +0800 CST

如何在 Bash 数组中使用星号 (*)

  • 5

我想将所有内容存储command args在一个中array,但它只有当所有参数都没有任何(*)时才有效。

这是一个不使用数组的测试:

mkdir -p /tmp/hello
echo "hello" > /tmp/hello/hello.txt
echo "world" > /tmp/hello/world.txt

mkdir -p /tmp/world

# This cp command is success
cp /tmp/hello/* /tmp/world

现在将 cp 命令转换为 my_array:

mkdir -p /tmp/hello
echo "hello" > /tmp/hello/hello.txt
echo "world" > /tmp/hello/world.txt

mkdir -p /tmp/world

declare -a my_array=()
my_array[0]="cp"
my_array[1]="/tmp/hello/*"
my_array[2]="/tmp/world"

# Run the command and it will fail
"${my_array[@]}"

错误如下:

cp: cannot stat '/tmp/hello/*': No such file or directory

*在 中可以使用 ( ) 吗?使用 实现 ' ' 的my_array正确语法是什么?cp /tmp/hello/* /tmp/worldmy_array

更新:

有一个problem来自@choroba's answoer,$count和$sedond_item将是错误的:

mkdir -p /tmp/hello
echo "hello" > /tmp/hello/hello.txt
echo "world" > /tmp/hello/world.txt

mkdir -p /tmp/world

my_array=(cp)
my_array+=(/tmp/hello/*)
my_array+=(/tmp/world)

count=${#my_array[@]}
printf "%s\n" "count is: $count"

sedond_item="${my_array[1]}"
printf "%s\n" "second item is: $sedond_item"

以下是@choroba 回答的输出:

count is: 4
second item is: /tmp/hello/hello.txt

但在我的原始数组中$count和是正确的:$sedond_item

mkdir -p /tmp/hello
echo "hello" > /tmp/hello/hello.txt
echo "world" > /tmp/hello/world.txt

mkdir -p /tmp/world

declare -a my_array=()
my_array[0]="cp"
my_array[1]="/tmp/hello/*"
my_array[2]="/tmp/world"

count=${#my_array[@]}
printf "%s\n" "count is: $count"

sedond_item="${my_array[1]}"
printf "%s\n" "second item is: $sedond_item"

这是原始数组的输出:

count is: 3
second item is: /tmp/hello/*
command-line
  • 2 个回答
  • 119 Views
Martin Hope
stackbiz
Asked: 2024-06-01 16:22:57 +0800 CST

如何使用setfacl添加相同的权限

  • 8

setfacl我从这个链接找到了:

https://stackoverflow.com/questions/39397548/how-to-give-non-root-user-in-docker-container-access-to-a-volume-mounted-on-the

sudo setfacl -m u:$(id -u):rwx -R /some/folder

rwx但它会根据我的要求设置所有文件权限different。

这是测试文件夹:

rm -rf /test
mkdir -p /test/hello/world

echo "hello" > /test/hello.txt

echo "hi" > /test/hi.sh
chmod 755 /test/hi.sh

echo "foo" > /test/foo.sh
chmod 400 /test/foo.sh

echo "bar" > /test/bar.sh
chmod 700 /test/bar.sh

这是文件权限:

# ls -l /test

-rwx------ 1 root root    4 Jun  1 12:20 bar.sh
-r-------- 1 root root    4 Jun  1 12:20 foo.sh
drwxr-xr-x 3 root root 4096 Jun  1 12:20 hello
-rw-r--r-- 1 root root    6 Jun  1 12:20 hello.txt
-rwxr-xr-x 1 root root    3 Jun  1 12:20 hi.sh

我想授予用户1234相同的权限root:

sudo setfacl -m u:1234:(???) -R /test

这是用户 1234 的预期权限(这里不更改所有者,只是在这里使用 1234 来解释详细权限,与用户 root 相同):

# ls -l /test

-rwx------ 1 1234 root    4 Jun  1 12:20 bar.sh
-r-------- 1 1234 root    4 Jun  1 12:20 foo.sh
drwxr-xr-x 3 1234 root 4096 Jun  1 12:20 hello
-rw-r--r-- 1 1234 root    6 Jun  1 12:20 hello.txt
-rwxr-xr-x 1 1234 root    3 Jun  1 12:20 hi.sh

这个怎么写呢sudo setfacl -m u:1234:(???) -R /test?

command-line
  • 1 个回答
  • 105 Views
Martin Hope
stackbiz
Asked: 2024-05-29 18:43:57 +0800 CST

如何在Docker层中挂载主机目录并修改其内容

  • 7

以下是我想要实现的 docker 层: https://stackoverflow.com/questions/31222377/what-are-docker-image-layers

我想使用以下命令将文件夹从主机挂载到 docker:

docker run \
-v /path/to/host/large_size_folder:/var/large_size_folder \
my_docker \
/bin/bash -c "rm -rf /var/large_size_folder/file1 && echo "hello" > /var/large_size_folder/file2"

因为它的大小/path/to/host/large_size_folder非常大,所以我不想将其复制到docker镜像中。所以我习惯-v将它挂载到docker镜像上。

然后,我运行 docker 并使用 bash 来查看add/modify/delete“ ”内的文件/var/large_size_folder。

但此操作也会从主机添加/修改/删除文件。

在 中docker layer only运行时是否可以在不影响主机目录的情况下进行任何修改?/bin/bash -c "rm -rf /var/large_size_folder/file1 && echo "hello" > /var/large_size_folder/file2"docker container

bash
  • 1 个回答
  • 51 Views
Martin Hope
stackbiz
Asked: 2024-05-20 18:07:10 +0800 CST

“!!”的真正含义是什么?在 Ubuntu 上的 /etc/shadow 中

  • 5

stackexchange 链接显示“无法使用密码登录该帐户”,但baeldung 链接显示“任何人都可以在没有任何密码的情况下登录该帐户”。

堆栈交换链接:

两个都 ”!” 和 ”!!” 出现在密码字段中意味着无法使用密码登录该帐户。

从 RHEL-4 的文档中可以看出,“!!” 影子密码字段中的内容表示用户帐户已创建,但尚未指定密码。该文档指出(可能是错误的),在系统管理员提供初始密码之前,它默认处于锁定状态。

baeldung链接:

  1. !! 在 /etc/shadow 的密码字段中

    我们在 /etc/shadow 文件的密码字段中可能遇到的另一个符号是两个感叹号。!! 表示某人已创建用户帐户但未为其指定密码。因此,任何人都可以在没有任何密码的情况下登录该帐户,这是一个严重的风险。

哪个对于Ubuntu系统是正确的?

permissions
  • 1 个回答
  • 51 Views
Martin Hope
stackbiz
Asked: 2024-05-13 19:40:05 +0800 CST

Ubuntu下如何让一个包变成“卸载”状态

  • 4

我正在尝试检查是否安装了某个软件包。

以下是查找所有状态为“”的软件包的链接deinstall: dpkg --get-selections 显示标记为“deinstall”的软件包

但我无法deinstall从我的运行Ubuntu系统中找到任何带有“”的软件包。

可以使用什么命令使“ installed”包成为“ deinstall”以进行测试?

apt
  • 1 个回答
  • 43 Views
Martin Hope
stackbiz
Asked: 2024-05-13 17:37:58 +0800 CST

如何在 bash 的一个命令行中获取软件包版本[重复]

  • 7
这个问题在这里已经有答案了:
如何调整“dpkg -l”输出 (1 个回答)
昨天关门了。

我试图systemd在以下命令中获取已安装的版本,但它返回包含关键字“ systemd”的所有行。

# dpkg -l | grep " systemd "

ii  gnome-logs                                       42.0-1                                                           amd64        viewer for the systemd journal
ii  libsystemd0:amd64                                249.11-0ubuntu3.12                                               amd64        systemd utility library
ii  systemd                                          249.11-0ubuntu3.12                                               amd64        system and service manager
ii  systemd-container                                249.11-0ubuntu3.12                                               amd64        systemd container/nspawn tools

如何让它只返回以下行:

# dpkg -l | grep "__the_rule_for_systemd_"

ii  systemd                                          249.11-0ubuntu3.12                                               amd64        system and service manager

然后,我可以使用 awk 来获取版本:

# dpkg -l | grep "__the_rule_for_systemd_" | awk '{print $3}'

这是预期的输出:

249.11-0ubuntu3.12

__the_rule_for_systemd_“ ”怎么写grep或者有没有其他命令可以获取已安装的版本systemd?

笔记:

# package_name="systemd"
# dpkg -l | grep " $package_name "

“ __the_rule_for_systemd_”也应该适用于其他包,它应该能够通过该规则获取任何包,而不仅仅是“ systemd”。

command-line
  • 1 个回答
  • 24 Views
Martin Hope
stackbiz
Asked: 2024-05-02 12:47:07 +0800 CST

删除 /dev 挂载点而不在主机中卸载

  • 7

以下是unmount卸载所有先前安装的文件夹的方法:

https://unix.stackexchange.com/questions/61885/how-to-unmount-a-known-chrootd-filesystem

我使用以下命令将/sys和挂载/dev到:chrootUbuntu host

cd /path/to/chroot/
mount -t sysfs /sys sys
mount -o bind /dev dev

如果我先删除without内的/sysand :/devchrootunmounting

chroot /path/to/chroot
rm -rf /sys
rm -rf /dev

会delete everything在然后host system到cause damage吗host system?

bash
  • 1 个回答
  • 34 Views
Martin Hope
stackbiz
Asked: 2024-02-18 00:21:15 +0800 CST

如何从 Ubuntu 桌面应用程序 UI 隐藏桌面

  • 6

我找到了以下用于更改文件类型应用程序的链接:

https://superuser.com/questions/21626/ubuntu-change-the-default-program-used-to-open-a-type-of-file

application/pdf以下是将文件类型“ ”与“ ”相关联的命令kde-kpdf.desktop:

$xdg-mime query default application/pdf
AdobeReader.desktop
$xdg-mime default kde-kpdf.desktop application/pdf
$xdg-mime query default application/pdf
kde-kpdf.desktop

我只想打开double-click“*.pdf”,然后用“kde-kpdf.desktop”打开,

但我想kde-kpdf.desktop从 Ubuntu 桌面应用程序列表中隐藏“ ”,如下所示(我从互联网下载了该图像,它不包含 kde-kpdf.desktop 图标):

在此输入图像描述

是否可以*.desktop从 Ubuntu 应用程序列表 UI 中隐藏指定的文件?如何隐藏桌面但仍允许double-click使用该应用程序打开文件类型?

bash
  • 2 个回答
  • 46 Views
Martin Hope
stackbiz
Asked: 2023-12-18 20:12:54 +0800 CST

如何在 Ubuntu 中转换 nvidia-container-toolkit.list

  • 5

nvidia-container-toolkit.list以下是原文GitHub:

https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list

deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/deb/$(ARCH) /

这是 Nvidia 的文档:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

我尝试signed-by手动添加“ ”,然后将“ $(ARCH)”替换为“ amd64”或“ amd64”:

deb [signed-by=/usr/share/keyrings/nvidia.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/amd64 /

or 

deb [signed-by=/usr/share/keyrings/nvidia.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/ amd64 /

但“ apt-get update”失败并出现以下错误:

E: Malformed line 1 in source list /etc/apt/sources.list.d/nvidia-container-toolkit.list (type)
E: The list of sources could not be read.

这是echo $(ARCH)Ubuntu 中的:

# echo $(ARCH)
ARCH: command not found

“”的正确形式是什么nvidia-container-toolkit.list?

更新:

如果我不替换$(ARCH),错误仍然是相同的。我认为原来的nvidia文档是错误的。

更新2:

问题可能与“$(ARCH)”有关,nvidia中的$(ARCH)是什么?

apt
  • 1 个回答
  • 32 Views
Martin Hope
stackbiz
Asked: 2023-08-19 18:28:38 +0800 CST

如何在 Ubuntu 中以“non_root”用户身份执行命令

  • 5

登录Ubuntu系统时,登录用户为“ root”。

然后,我想代表“ non_root”执行一些bash脚本:

root@test_pc:~# echo $USER
root
root@test_pc:~# sudo -E -u non_root -g non_root -H /bin/bash -c "echo $USER"
root
root@test_pc:~# 

但输出仍然是“ root”,换句话说,该命令仍然是在“ root”用户下执行,而不是在“ non_root”下执行。

这是预期的输出:

root@test_pc:~# sudo -E -u non_root -g non_root -H /bin/bash -c "echo $USER"
non_root
root@test_pc:~#

下面是真实的操作:

sudo -E -u non_root -g non_root -H /bin/bash -c "systemctl --user disable pulseaudio.service"

但出现以下错误:

Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)

non_root当使用“ ”用户登录时,如何以“ ”身份执行任何bash命令root?

command-line
  • 1 个回答
  • 62 Views
Martin Hope
stackbiz
Asked: 2023-08-18 11:50:26 +0800 CST

Ubuntu 桌面中设置窗口大小的配置文件在哪里

  • 5

我想在 bash 脚本中设置窗口大小,但我不知道使用哪个命令来设置窗口大小。

当在 Ubuntu 桌面中打开文件浏览器,然后通过拖动文件浏览器的右下角来更改文件浏览器的窗口大小,然后关闭窗口并重新打开文件浏览器时,窗口大小将更改为最后的大小。

这是文件浏览器的图片: 在此输入图像描述

用于存储文件浏览器最后更新的窗口大小的配置文件在哪里?或者什么bash命令可以用来设置窗口大小?

command-line
  • 1 个回答
  • 31 Views
Martin Hope
stackbiz
Asked: 2023-02-23 23:45:42 +0800 CST

ubuntu-22.04.2 版本在哪里

  • 8

根据下面的启动板,ubuntu-22.04.2已经在 15 小时前发布了。

https://launchpad.net/ubuntu/+milestone/ubuntu-22.04.2

Milestone information
Project:
    Ubuntu
Series:
    Jammy
Version:
    ubuntu-22.04.2
Expected:
    15 hours ago   
Active:
    Yes. Drivers can target bugs and blueprints to this milestone. 

但是下面的链接还是说最新的是22.04.1:

https://ubuntu.com/download/desktop

Ubuntu 22.04.1 LTS
The latest LTS version of Ubuntu, for desktop PCs and laptops. LTS stands for long-term support — which means five years of free security and maintenance updates, guaranteed until April 2027.

ubuntu-22.04.2如中所述,在哪里下载launchpad?

22.04
  • 1 个回答
  • 198 Views
Martin Hope
stackbiz
Asked: 2022-12-28 03:32:27 +0800 CST

如何使用“sed”替换 bash 上多行 xml 内容中的 xml 标记

  • 5

我想用来sed替换 .xml 上的 XML 标记bash。

这是用于测试的示例 xml 内容:

<xml-content>
<validation>
<timeout>2880</timeout>
<subject>example</subject>
<required>true</required>
</validation>
</xml-content>

我想更换标签validation:

<validation>
<timeout>2880</timeout>
<subject>example</subject>
<required>true</required>
</validation>

使用新标签other-tag:

<other-tag>
<hello/>
<more>false</more>
</other-tag>

这是最终的预期结果:

<xml-content>
<other-tag>
<hello/>
<more>false</more>
</other-tag>
</xml-content>

如何使用单个命令行来完成sed?

command-line
  • 1 个回答
  • 136 Views
Martin Hope
stackbiz
Asked: 2022-12-27 23:33:47 +0800 CST

在反向代理后面配置 Archiva 时正在加载 Web UI

  • 5

我已经设置好archiva并httpd打开Ubuntu 22.04进行测试。

Apache Archiva version: 2.2.9
Apache HTTP Server: 2.4.52

虚拟主机配置:

<VirtualHost _default_:443>
    ProxyPass "/test/" "http://192.168.1.1:8080/"
    ProxyPassReverse "/test/" "http://192.168.1.1:8080/"
</VirtualHost>

HTTP 服务器 URL:https:
//my.example.com/test/ Archiva 服务器 URL:http: //192.168.1.1 :8080/

当使用Firefox直接打开http://192.168.1.1:8080/时,整个Archiva UI可以正常显示。

当使用 Firefox 打开https://my.example.com/test/时,Firefox 可以显示title为 " Apache Archiva" 但 Web Content 不显示,它只显示 " Loading"...

在此处输入图像描述

VirtualHost使Archivato 工作时缺少什么Reverse Proxy?

更新:这是来自 Firefox 的视图源代码:

查看源代码:https ://my.example.com/test/

<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="css/jquery.fileupload-ui.css"/>
    <link rel="stylesheet" href="css/jqueryFileTree.css"/>
    <link rel="stylesheet" href="css/jquery-ui-1.9.2.custom.min.css"/>
    <link rel="stylesheet" href="css/select2-3.2.css"/>
    <link rel="stylesheet" href="css/typeahead.js-bootstrap.0.9.3.css"/>
    <link rel="stylesheet" href="css/bootstrap.2.2.2.css">
    <link rel="stylesheet" href="css/archiva.css">
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" href="css/prettify.css"/>

    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.10.4.min.js"></script>
    <script type="text/javascript" src="js/sammy.0.7.4.js"></script>
    <script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.min.2.1.11.js"></script>

    <title>Apache Archiva</title>

  </head>
...

查看源代码:https ://my.example.com/test/js/archiva/archiva.js

requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.cookie-information'], function () {
        loadi18n(function () {
          $.ajax({
            url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
            dataType: 'json',
            success:function(data){
              window.archivaDevMode=data.devMode;
              window.archivaJavascriptLog=data.javascriptLog;
              window.archivaRuntimeInfo=data;

              window.cookieInformation=mapCookieInformation(data.cookieInformation);

              require(['sammy','jquery','jquery.ui','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
                  startArchivaApplication();
                  $("#loadingDiv").hide();
                  drawQuickSearchAutocomplete();
              })
            }
          })
        });
      });  


  

从中view source,Firefox可以从中获取到正确的html内容Archiva 8080 server,但是无法激活js函数“ loadi18n”,“ $("#loadingDiv").hide();”根本不执行。

for 中的“ js/archiva/archiva.js”Archiva无法按预期reverse proxy mode工作unknown reason。

apache2
  • 1 个回答
  • 35 Views
Martin Hope
stackbiz
Asked: 2022-12-08 03:19:40 +0800 CST

如何从 iptables 日志中找出程序

  • 6

在 ubuntu 22.04 上测试 ping:

Host A IPv6: 1111:1111:1111:1111:1111:1111:1111:1111
Host B IPv6: 2222:2222:2222:2222:2222:2222:2222:2222

主持人A:

现在使用以下 bash 命令从主机 A 执行 ping:

root@host_a:~# ping -6 2222:2222:2222:2222:2222:2222:2222:2222

主持人乙:

iptables 丢弃了一些数据包并将其记录到文件中:

12 月 7 日 18:21:52 host_b 内核:[ 988.996335] 丢弃输出:IN= OUT=ens33 SRC=192.168.1.1 DST=192.168.2.1 LEN=83 TOS=0x00 PREC=0x00 TTL=64 ID=52289 PROTO=UDP SPT =41151 DPT=53 LEN=63 UID=113 GID=118

12 月 7 日 18:21:52 host_b 内核:[ 988.998359] 丢弃输出:IN= OUT=ens33 SRC=2222:2222:2222:2222:2222:2222:2222:2222 DST=1111:1111:1111:1111:1111: 1111:1111:1111 LEN=72 TC=0 HOPLIMIT=255 FLOWLBL=0 PROTO=ICMPv6 TYPE=136 CODE=0

12 月 7 日 18:21:53 host_b 内核:[ 990.001075] 丢弃输出:IN= OUT=ens33 SRC=2222:2222:2222:2222:2222:2222:2222:2222 DST=1111:1111:1111:1111:1111: 1111:1111:1111 LEN=72 TC=0 HOPLIMIT=255 FLOWLBL=0 PROTO=ICMPv6 TYPE=136 CODE=0

从first log line,有一个UID和GID信息:

UID=113 GID=118

我们可以使用以下方法找到用户:

root@host_b:~# cat /etc/passwd | grep 113

但是对于2ndand3rd行,日志中没有任何UIDor GID。

题:

如何找出哪个程序正在发送以下网络数据包?

PROTO=ICMPv6 TYPE=136 CODE=0

注意:根据 iptables 日志,这个“未知”程序接受传入的 ICMPv6 数据包,然后发出传出的 ICMPv6 数据包,但是当数据包被规则丢弃时,iptables 无法记录该“未知”程序的 UID 和 GID。

networking
  • 1 个回答
  • 41 Views

Sidebar

Stats

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

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve