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

AlexP's questions

Martin Hope
AlexP
Asked: 2021-05-08 04:03:36 +0800 CST

mount.nfs:无法解析服务器/:名称或服务未知

  • 0

我正在尝试使用 NFS 切换 CIFS 协议以挂载分区(很可能是共享的 windows 文件夹,不确定)。我想这样做,因为对于 CIFS,我需要使用即将过期的凭据。/etc/fstab 的内容:

UUID=c89643e8-ac97-11e8-8d9f-00155d004c13 / ext4 defaults 0 0
UUID=c7692878-ac97-11e8-8d9f-00155d004c13 /boot ext4 defaults 0 0
UUID=B02C-6926 /boot/efi vfat defaults 0 0
//10.95.176.67:/DataStore  /mnt/DataStore nfs iocharset=utf8,rw,vers=3.0,sec=ntlmssp,cache=strict,domain=BOE,uid=1000,noforceuid,gid=1000,noforcegid,file_mode=0755,dir_mode=0755,nounix,rsize=61440,wsize=65536,actimeo=1 0  0

所以我用 nfs 切换了 cifs,并从 /etc/fstab 中删除了凭据。但我得到这个错误:

$> mount  /mnt/DataStore
mount.nfs: Failed to resolve server //10.95.176.67: Name or service not known

使用 CIFS,我能够完美安装。有人知道如何解决这个问题吗?

肿瘤坏死因子。

编辑:

tcpdump host 10.95.176.67

15:04:35.906115 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271784599 ecr 0,nop,wscale 7], length 0
15:04:36.932328 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271785625 ecr 0,nop,wscale 7], length 0
15:04:38.948352 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271787641 ecr 0,nop,wscale 7], length 0
15:04:43.172356 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271791865 ecr 0,nop,wscale 7], length 0
15:04:51.364376 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271800057 ecr 0,nop,wscale 7], length 0
15:05:07.492394 IP is2.695 > netapp01-1.boecillo.eemea.ericsson.se.635: Flags [S], seq 211338160, win 64240, options [mss 1460,sackOK,TS val 1271816185 ecr 0,nop,wscale 7], length 0
partitioning
  • 1 个回答
  • 4222 Views
Martin Hope
AlexP
Asked: 2021-04-14 10:08:56 +0800 CST

无法更新 ubuntu / [重复] 中的存储库

  • 0
这个问题在这里已经有了答案:
如何安装软件或从旧的不受支持的版本升级? (12 个回答)
去年关闭。

我想在 Ubuntu 上安装一些软件,但首先我想更新软件包,我收到了这个:

sudo apt-get update
Ign:1 http://ro.archive.ubuntu.com/ubuntu eoan InRelease
Ign:2 http://ro.archive.ubuntu.com/ubuntu eoan-updates InRelease                                       
Ign:3 http://ro.archive.ubuntu.com/ubuntu eoan-backports InRelease                                     
Hit:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan InRelease             
Err:5 http://ro.archive.ubuntu.com/ubuntu eoan Release                                         
  404  Not Found [IP: 91.209.189.249 80]
Err:6 http://ro.archive.ubuntu.com/ubuntu eoan-updates Release                                 
  404  Not Found [IP: 91.209.189.249 80]
Ign:7 http://security.ubuntu.com/ubuntu eoan-security InRelease                                
Hit:8 http://ppa.launchpad.net/phpmyadmin/ppa/ubuntu eoan InRelease                            
Err:9 http://ro.archive.ubuntu.com/ubuntu eoan-backports Release                               
  404  Not Found [IP: 91.209.189.249 80]
Err:10 http://security.ubuntu.com/ubuntu eoan-security Release
  404  Not Found [IP: 91.189.88.152 80]
Reading package lists... Done
E: The repository 'http://ro.archive.ubuntu.com/ubuntu eoan Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ro.archive.ubuntu.com/ubuntu eoan-updates Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ro.archive.ubuntu.com/ubuntu eoan-backports Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://security.ubuntu.com/ubuntu eoan-security Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details

我不知道到底发生了什么,因为我以前从来没有遇到过问题。你能帮我完成这项工作吗?我有 Ubuntu 19 版本:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.10
Release:    19.10
Codename:   eoan
apt
  • 1 个回答
  • 230 Views
Martin Hope
AlexP
Asked: 2021-03-29 10:34:13 +0800 CST

你可以从 Linux 命令行设置 socks5 代理吗?

  • 2

我设法将一个 socks5 代理服务器从 Linux 设置到另一台服务器,如下所示:

ssh -D 9090 -N -f user@192.168.76.102 然后我更改了Mozilla浏览器中的设置以使用socks代理,它可以工作,我可以上网。我想要做的是在 Linux 命令行中设置这个设置,这样我就可以从那里访问互联网,就像这样:wget www.google.com。首先我尝试编辑 /etc/environmental 文件:

export http_proxy=socks5://127.0.0.1:9090 

但它不起作用:

wget www.google.com 
Error parsing proxy URL socks5://127.0.0.1:9090: Unsupported scheme ‘socks5’.

然后我安装了 proxychains4 ,并在 /etc/proxychains4.conf 添加:

socks5 127.0.0.1 9090

但仍然不起作用:

Resolving www.google.com (www.google.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.google.com

你有什么想法可以让我完成这项工作吗?

谢谢。

networking
  • 1 个回答
  • 12821 Views
Martin Hope
AlexP
Asked: 2021-03-06 12:03:00 +0800 CST

如何允许 iptables 中端口的特定 IP 上的流量

  • 0

我想限制端口 5041 上除 10.2.3.4 之外的所有 IP 的流量

首先,我允许访问端口上的 IP,如下所示:

iptables -A IN_public_allow -s 10.2.3.4 -p tcp -m tcp --dport 5041 -m conntrack --ctstate NEW -j ACCEPT

然后我限制了所有 IP 的访问:

iptables -A IN_public_allow -p tcp -m tcp --dport 5041 -m conntrack --ctstate NEW -j DROP

所以理论上,我应该只能从 IP 10.2.3.4 访问端口,但事实并非如此。我正在使用 ncat 对此进行测试,方法是使用 -s 选项更改源地址:

ncat.exe -s 10.2.3.5 -zv  10.78.21.51 5041
libnsock mksock_bind_addr(): Bind to 10.2.3.5:0 failed (IOD #1): The requested address is not valid in its context.  (10049)
Ncat: Connected to :10.78.21.51:5041.
Ncat: 0 bytes sent, 0 bytes received in 0.12 seconds

因此,该命令看起来像是从 IP 10.2.3.5 连接到端口,尽管它不应该有。我不知道libnsock mksock_bind_addr(): Bind to 10.2.3.5:0 failed错误是什么意思。请帮忙,谢谢。

编辑:iptables -xvnL按要求输出命令:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination
642614522 702873881336 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
  454146 27240797 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
  392972 20241510 INPUT_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  392972 20241510 INPUT_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  392972 20241510 INPUT_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       3      120 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID
    4070   483366 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
       0        0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
       0        0 FORWARD_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FORWARD_IN_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FORWARD_IN_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FORWARD_OUT_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FORWARD_OUT_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID
       0        0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 326255 packets, 205303698 bytes)
    pkts      bytes target     prot opt in     out     source               destination
488899038 266093163662 OUTPUT_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD_IN_ZONES (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 FWDI_public  all  --  bond1  *       0.0.0.0/0            0.0.0.0/0           [goto]
       0        0 FWDI_public  all  --  bond0  *       0.0.0.0/0            0.0.0.0/0           [goto]
       0        0 FWDI_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           [goto]

Chain FORWARD_IN_ZONES_SOURCE (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FORWARD_OUT_ZONES (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 FWDO_public  all  --  *      bond1   0.0.0.0/0            0.0.0.0/0           [goto]
       0        0 FWDO_public  all  --  *      bond0   0.0.0.0/0            0.0.0.0/0           [goto]
       0        0 FWDO_public  all  --  *      +       0.0.0.0/0            0.0.0.0/0           [goto]

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FORWARD_direct (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDI_public (3 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 FWDI_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FWDI_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FWDI_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FWDI_public_allow (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDI_public_deny (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDI_public_log (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDO_public (3 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 FWDO_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FWDO_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 FWDO_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FWDO_public_allow (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDO_public_deny (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain FWDO_public_log (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain INPUT_ZONES (1 references)
    pkts      bytes target     prot opt in     out     source               destination
    4307   492298 IN_public  all  --  bond1  *       0.0.0.0/0            0.0.0.0/0           [goto]
  388631 19744052 IN_public  all  --  bond0  *       0.0.0.0/0            0.0.0.0/0           [goto]
      34     5160 IN_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           [goto]

Chain INPUT_ZONES_SOURCE (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain INPUT_direct (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain IN_public (3 references)
    pkts      bytes target     prot opt in     out     source               destination
  392972 20241510 IN_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  392972 20241510 IN_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  392972 20241510 IN_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0

Chain IN_public_allow (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:3179 ctstate NEW
    2477   145924 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:5534 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:5524 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8434 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:5056 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:3189 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 ctstate NEW
       0        0 ACCEPT     tcp  --  *      *       10.2.3.4        0.0.0.0/0            tcp dpt:5041 ctstate NEW
       5      260 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:5041 ctstate NEW

Chain IN_public_deny (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain IN_public_log (1 references)
    pkts      bytes target     prot opt in     out     source               destination

Chain OUTPUT_direct (1 references)
    pkts      bytes target     prot opt in     out     source               destination

networking
  • 1 个回答
  • 716 Views
Martin Hope
AlexP
Asked: 2021-02-26 12:00:23 +0800 CST

使用 nano 编辑器或邮件(后缀)命令时,rsync 日志文件损坏

  • 0

我有一个奇怪的情况,我将 rsync 命令的整个输出重定向到一个文件,如果我用 nano 编辑器打开它或者将输出发送到 Outlook 邮件,文件就会损坏。如果我使用 cat 命令,它看起来没问题:

cat rsync_log.txt

file1.sql
          5.04G 100%   20.80MB/s    0:03:51 (xfr#1, to-chk=0/1)

sent 568.29K bytes  received 292.02M bytes  854.27K bytes/sec
total size is 5.04G  speedup is 17.24
receiving incremental file list

但是,如果我用 nano 打开文件,它看起来像这样:

file1.sql
receiving incremental file list
^M              0   0%    0.00kB/s    0:00:00  ^M         13.85M   0%   12.31MB/s    0:06:39  ^M         51.85M   1%   23.87MB/s    0:03:24  ^M         76.78M   1%   2$ 

此外,如果我将包含在 html 标记中的文件内容发送到 Outlook 邮件(这是我真正需要的),它看起来像这样:

cat rsync_log_wrapped_in_html.html | mail -a "Content-Type: text/html" -s "test" mail@example.com

file.sql
              0   0%    0.00kB/s    0:00:00           13.85M   0%   12.31MB/s    0:06:39           51.85M   1%   23.87MB/s    0:03:24           76.78M   1%   22.75MB/s    0:03:33           96.60M   1%   20.77MB/s    0:03:52          104.91M   2%   19.69MB/s    0:04:04          110.95M   2%   12.75MB/s    0:06:17          114.65M   2%    8.40MB/s    0:09:32          124.31M   2%    6.39MB/s    0:12:31          141.71M   2%    8.52MB/s    0:09:22          156.63M   3%   10.48MB/s    0:07:35          163.16M   3%   11.12MB/s    0:07:08          187.10M   3%   14.58MB/s    0:05:25          203.72M   4%   14.50MB/s    0:05:26          209.76M   4%   12.57MB/s    0:06:15          213.88M   4%   11.49MB/s    0:06:50          217.93M   4%    6.91MB/s    0:11:22          222.47M   4%    3.94MB/s    0:19:55          234.70M   4%    5.18MB/s    0:15:06          238.46M   4%    5.24MB/s    0:14:56          243.78M   4%    5.57MB/s    0:14:01          257.35M   5%    8.02MB/
 s    0:09:43          264.74M   5%    6.92MB/s    0:11:14          269.72M   5%    7.19MB/s    0:10:48          283.57M   5%    9.14MB/s    0:08:28          315.04M   6%   13.28MB/s    0:05:47          336.63M   6%   16.33MB/s    0:04:41          352.96M   6%   19.35MB/s    0:03:56          357.15M   7%   16.98MB/s    0:04:29          360.49M   7%   10.19MB/s    0:07:28          369.80M   7%    7.57MB/s    0:10:02          386.99M   7%    7.37MB/s    0:10:16          402.76M   7%    9.96MB/s    0:07:34          411.99M   8%   10.33MB/s    0:07:17          422.93M   8%    9.82MB/s    0:07:39          430.88M   8%    7.49MB/s    0:10:01          457.08M   9%    9.26MB/s    0:08:03          511.61M  10%   18.69MB/s    0:03:56          582.41M  11%   32.66MB/s    0:02:13          615.00M  

输出要长很多,这只是其中的一小部分。该文件还包含其他输出/日志,nano 可以查看这些输出/日志,并使用 mail 命令发送 ok。只有 rsync 部分搞砸了。我删除了文件并创建了一个新文件,没有任何变化。我不知道发生了什么,这真的很令人失望。我真的需要在 html 页面中将输出清楚地发送到 Outlook,请帮助,谢谢。

rsync
  • 1 个回答
  • 69 Views
Martin Hope
AlexP
Asked: 2021-02-17 01:05:06 +0800 CST

SSH 隧道 IP 过滤

  • 0

我在服务器 10.1.1.1 上创建了这个隧道: ssh -f -N -o -L 8789:10.2.2.2:22 user@10.2.2.2

这允许我通过端口 8789 从本地服务器连接到远程服务器,如下所示:ssh -p 8789 user@localhost

我想要实现的是让其他服务器也通过该端口连接到远程服务器 10.2.2.2,所以我提出了这个:

ssh -f -N -o -L 10.1.1.1:8789:10.2.2.2:22 user@10.2.2.2

这样,其他服务器,如 10.1.1.2 或 10.1.1.3(能够 ssh 进入 10.1.1.1),可以通过隧道连接到 10.2.2.2:

ssh -p 8789 user@10.1.1.1

问题是这样,每个有权访问 10.1.1.1 的人都可以使用该隧道,而我不希望这样。假设我只希望 10.1.1.2 和 10.1.1.3 能够使用该隧道。我该如何做到这一点?谢谢。

ssh
  • 1 个回答
  • 182 Views
Martin Hope
AlexP
Asked: 2021-02-02 06:17:01 +0800 CST

远程服务器上的 SSH 主机名命令显示本地服务器的主机名

  • -1

我从 server2 上的 server1 运行这个 SSH 命令:

ssh server2 echo pasword | su - root  -c "echo this is the  `hostname`" 

我希望结果是 server2 的主机名,但我得到的是 server1 的主机名。如何操作命令以获取服务器 2 的主机名?

谢谢。

bash
  • 2 个回答
  • 3400 Views
Martin Hope
AlexP
Asked: 2020-06-16 13:55:29 +0800 CST

从bash中的for循环打印参数

  • 0

所以,我想打印满足某些条件的脚本参数:

t1=0

for i in $@; do


if [ $i == "-1" ] || [ $i == "-2" ] || [ $i == "-3" ]; then

t2=$(($t1+2))

echo $i $"$t2"

fi

t1=$(($t1+1))

done

如果我这样调用脚本:

./name_of_script  -2 aaa -m bbb -3 ccc -4 ccc -1 ddd

我希望它打印这样的东西:

-2 aaa
-3 ccc
-1 ddd

所以我想打印 -1 、 -2 或 -3 的参数,以及紧随其后的每个参数。但我得到了这个:

-2 2
-3 6
-1 10

我只是不能将 2、6 和 10 变成 $2、$6 和 $10,所以我可以打印脚本的这些参数。

有任何想法吗 ?非常感谢。

scripts command-line bash
  • 1 个回答
  • 140 Views
Martin Hope
AlexP
Asked: 2020-06-16 12:00:41 +0800 CST

添加到迭代的零长度变量不起作用

  • 0

问题很简单。我在 bash 中有以下脚本:

#!/bin/bash

a=`echo " 1 2 3 hello " | egrep -o "1"`
b=`echo " 1 2 3 hello " | egrep -o "2"`
c=`echo " 1 2 3 hello " | egrep -o "4"`

echo $a
echo $b
echo $c
echo "--"

echo "first print : "

if [ -z $c ]; then echo "zero length"; fi # condition met

echo "second print : "

for i in $a $b $c; do

if [ -z $i ]; then echo "zero length" # does not recognize variable $c , no print

fi
done

有3个变量,a,b和c。c 是唯一一个为空的,它内部的字符串长度为零。第一个“if”证明了这一点,但是,当我尝试将变量添加到“for”迭代时,条件无法识别。我怎样才能使这项工作?我需要这样做,因为我有很多变量需要在一个循环中进行测试,而不是对每个变量都使用一个“if”。太感谢了。

bash environment-variables
  • 1 个回答
  • 36 Views
Martin Hope
AlexP
Asked: 2020-04-23 13:49:07 +0800 CST

phpMyadmin 在 Ubuntu 上显示代码而不是 GUI

  • 0

请不要让我参考其他页面,因为我已经阅读了所有内容,但它们没有帮助。我需要有经验的人来帮助我。

我已经清除并重新安装了 apache2、PHP 7.4 和 phpmyadmin,当我在浏览器中键入 localhost/phpmyadmin 时,它会显示 php 代码。我已经尝试了一切。在 apache2.conf 中,我配置了:

Include /etc/phpmyadmin/apache.conf

在 mime.conf 中,我配置了:

AddType application/x-httpd-php .php

PHP7.4 模块已安装并启用(通过 a2enmod )

Web 服务器正在工作。我在 /var/www/html 中创建了一个包含 php 代码的文件:<?php echo("Success"); ?>,并且页面运行成功。

我不知道还能做什么。请帮忙。谢谢你。

apache2 phpmyadmin
  • 1 个回答
  • 441 Views
Martin Hope
AlexP
Asked: 2019-11-28 17:34:26 +0800 CST

从 bash / 结果列运行的文件中的 MySQL 命令未对齐

  • 0

我已经设法从 bash 命令行运行 MySQL,并使用来自文件的查询,如下所示:

mysql -u root -p$(cat pass.txt) < file1.sql 

结果如下:

id      name    food    confirmed       signup_date     email   salary
1       John    Casserole       Y       2012-04-11      NULL    125.00
2       Tom     BBQ     Y       2012-04-18      NULL    50.00
3       Tina    Salad   Y       2012-04-10      NULL    200.25
4       Mike    Fish    N       2012-04-19      NULL    50.00
5       July    Cake    N       2012-04-29      NULL    300.00

一切都很好,该命令有效,但有一个问题:所有输出列都未对齐,如您所见。一切都很乱。通常当我遇到这种问题时,我会用“tr”命令来解决,我是这样尝试的:

mysql -u root -p$(cat pass.txt) < file1.sql  | tr -s " "

但结果是一样的,没有任何变化。此外,我什至不能使用“剪切”命令。我试过了 :

mysql -u root -p$(cat pass.txt) < file1.sql  | cut -d " " -f2 

仍然是相同的输出。奇怪的。谁能帮帮我吗 ?如何使用来自文件的查询从 bash 运行 MySQL,并因此获得良好的对齐格式?非常感谢。

command-line bash mysql
  • 2 个回答
  • 608 Views
Martin Hope
AlexP
Asked: 2019-09-28 18:34:21 +0800 CST

使用 sudoers 文件阻止普通用户访问命令

  • 0

我想阻止普通用户在 sudoers 文件中使用命令。我根本不希望用户能够使用 sudo。我尝试像这样编辑 sudoers 文件:

student ALL=/usr/bin/*, !/usr/bin/pwd   

这似乎不起作用,因为用户可以访问 pwd 命令。但是,他无权使用 sudo 访问 pwd 命令(而可以使用 sudo 访问所有其他命令)。我想要的是限制用户使用 sudo,并限制使用 pwd 命令。这可以用 sudoers 文件完成吗?

谢谢。

permissions sudo
  • 1 个回答
  • 177 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