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

Gqqnbig's questions

Martin Hope
Gqqnbig
Asked: 2021-06-24 05:34:25 +0800 CST

有条件地停止交互式和非交互式 ssh 登录并给出错误信息

  • 1

我想防止基于条件逻辑的交互式和非交互式ssh 登录。我需要测试用户名并给出错误消息。

使用 sftp(非交互式 ssh)的人也应该接受幸运测试。

我将如何实施?我对系统有完全的控制权。

我尝试使用 sshd ForceCommand,但根据https://stackoverflow.com/a/33714333/746461它不适用于 notty。

我不熟悉 PAM,我怀疑 PAM 是否可以在登录是交互式的情况下输出自定义错误消息。

https://linuxhint.com/understanding_bash_shell_configuration_startup/表示带有选项的非交互式登录 shell--noprofile可以绕过所有 bash 配置文件。这就是为什么我不能在那里写我的逻辑。

20.04
  • 1 个回答
  • 170 Views
Martin Hope
Gqqnbig
Asked: 2021-03-02 19:58:00 +0800 CST

sudoers 文件中的 IP 规则不起作用

  • 0

我有两台服务器,a 和 b。当我登录到 a,然后 ssh 到 b 时,我不想为 sudo 命令输入密码。

在b上,我设置如果主机是172.25.9.13,sudo不需要密码。

gqqnbig@b:~$ sudo cat /etc/sudoers.d/cluster-create-user
%sudo 172.25.9.13=(ALL) NOPASSWD: ALL
gqqnbig@b:~$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# Limit members of group sudo to execute any command, except
test ALL=ALL, !/bin/su

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

现在我登录a,确保a的IP是172.25.9.13。然后我 ssh 到 b。但是, b 上的 sudo 仍然需要密码。

gqqnbig@a:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.9.13  netmask 255.255.255.0  broadcast 172.25.9.255
        inet6 fe80::3648:edff:fef9:9c1c  prefixlen 64  scopeid 0x20<link>
        ether 34:48:ed:f9:9c:1c  txqueuelen 1000  (Ethernet)
        RX packets 492366  bytes 127428889 (127.4 MB)
        RX errors 0  dropped 212004  overruns 0  frame 0
        TX packets 133728  bytes 21062341 (21.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 33

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2865  bytes 266771 (266.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2865  bytes 266771 (266.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


gqqnbig@a:~$ ssh b
...
Last login: Tue Mar  2 11:15:57 2021 from 172.28.80.67
gqqnbig@b:~$ sudo mkdir
[sudo] password for gqqnbig:

为什么 IP 规则不起作用?我该如何调试它?

ssh
  • 1 个回答
  • 58 Views
Martin Hope
Gqqnbig
Asked: 2020-06-19 17:47:42 +0800 CST

在 ubuntu live 上运行其他软件(暂时)

  • 0

我电脑的磁盘已损坏。我打算使用 Ubuntu 来恢复磁盘上的数据。

我去朋友家做了一个 Ubuntu U 盘。我认为 Ubuntu USB 记忆棒没有持久存储部分。

我的电脑从 Ubuntu USB 记忆棒成功启动,但我的恢复需要额外的软件。

$ sudo apt-get install testdisk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package testdisk

$ sudo apt-get update
...                  
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,272 B]                     
Fetched 3,789 kB in 12s (297 kB/s)                                                                             

** (appstreamcli:4232): CRITICAL **: Error while moving old database out of the way.
AppStream cache update failed.
Reading package lists... Done

在此处输入图像描述

apt-get 报告错误,我猜是因为 U 盘是一种只读模式?

我不想再打扰我的朋友制作一个持久的 USB 记忆棒。

在 Ubuntu Live 上运行其他软件的最简单方法是什么?

live-usb 16.04
  • 1 个回答
  • 521 Views
Martin Hope
Gqqnbig
Asked: 2019-08-01 13:05:56 +0800 CST

从窗口获取过程信息的简单方法

  • 20

在 Windows 上,我可以使用 Process Explorer 并将其十字准线拖到一个窗口中,然后 Process Explorer 会突出显示相关的进程。

在 Ubuntu 上,我在系统监视器中没有找到这样的功能。从窗口获取进程的简单方法是什么?

我愿意下载替代过程监视器或其他工具。

process window 18.04
  • 2 个回答
  • 2354 Views
Martin Hope
Gqqnbig
Asked: 2019-02-14 20:33:16 +0800 CST

如何判断命令是在运行还是在等待用户输入?

  • 19

在命令行上,我输入了一个命令并回车。它不输出任何东西。我如何判断它是否正在运行但尚未输出,或者它正在要求用户输入?

command-line process io
  • 5 个回答
  • 35707 Views
Martin Hope
Gqqnbig
Asked: 2019-02-03 20:15:18 +0800 CST

如果有多个类似的窗口,我如何判断哪个是可见窗口

  • 5

我打开了 4 个终端,其中 3 个是可见的,另一个是最小化的。

在此处输入图像描述

我想恢复最小化的窗口,即有 4 个窗口可见。

我单击终端图标,它显示 4 个预览。我应该单击哪个预览来恢复最小化的窗口?

无论如何,我的目标是恢复最小化的窗口。如果有更好的方法,请告诉我。

gnome-shell window minimize ubuntu-dock
  • 2 个回答
  • 247 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