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

Matt B's questions

Martin Hope
Matt B
Asked: 2017-05-05 13:19:58 +0800 CST

我应该允许 LDAP 通过 firewallD 吗?

  • 0

在 Centos 7 服务器上设置 firewallD。他们使用 LDAP 通过 SSH 登录进行身份验证。我是否需要在 FirewallD 的默认区域上明确允许端口 389 LDAP,或者因为 iv 允许 SSH 并且服务器最初将出站连接到 LDAP,返回入站连接不需要这样做吗?

我对 LDAP 不是很熟悉。我想连接到 LDAP 服务器的服务器可能只需要读取 LDAP 目录,而 LDAP 服务器不需要在端口 389 上发送任何数据?

linux
  • 1 个回答
  • 849 Views
Martin Hope
Matt B
Asked: 2017-03-17 08:57:04 +0800 CST

Ubuntu - adduser / useradd 都要求设置密码,可以强制脚本绕过这个吗?

  • 2

我有一个在 Centos 上运行良好的脚本,因为 useradd 不需要在那里设置密码,但是相同的脚本在 ubuntu 服务器上不起作用,因为它需要此信息。

理想情况下,我希望在我的脚本上强制不为 ubuntu 服务器设置密码,或者在 useradd 命令期间添加一行来设置密码。

如果我只是将 sudo passwd用户添加到我的脚本中,这只会在 useradd 命令之后生效,这为时已晚。

有任何想法吗?

linux scripting ubuntu bash useradd
  • 1 个回答
  • 1799 Views
Martin Hope
Matt B
Asked: 2017-03-17 02:58:57 +0800 CST

SELinux - 脚本将 SSH 密钥上传到远程服务器,但无法通过 SSH 连接

  • 1

我编写了这个脚本,它现在可以在没有安装 SElinux 的系统上完美运行。

echo Enter server IP:
read server
scp /home/Zenoss/.ssh/authorized_keys random@$server:/home/random
sshpass -p randompassword  ssh -t  random@$server sudo -i 'useradd zenoss; sudo mkdir /home/zenoss/.ssh; sudo mv /home/random/authorized_keys /home/zenoss/.ssh/;
sudo chmod 700 /home/zenoss/.ssh;
sudo chmod 600 /home/zenoss/.ssh/authorized_keys;
sudo chown -R zenoss /home/zenoss/.ssh;
sudo chgrp -R zenoss /home/zenoss/.ssh;
exit'

所以在没有 SElinux 的服务器上,脚本可以运行,然后 Zenoss 可以通过 SSH 登录到远程服务器并开始监控。但是在启用 SELinux 的系统上,脚本可以工作,但 Zenoss 无法通过 SSH 连接到远程服务器,调试信息显示它没有看到已成功设置的 authorized_keys 文件。

OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to ***** port 22.
debug1: Connection established.
debug1: identity file /home/zenoss/.ssh/id_rsa type 1
debug1: identity file /home/zenoss/.ssh/id_rsa-cert type -1
debug1: identity file /home/zenoss/.ssh/id_dsa type 2
debug1: identity file /home/zenoss/.ssh/id_dsa-cert type -1
debug1: identity file /home/zenoss/.ssh/id_ecdsa type -1
debug1: identity file /home/zenoss/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/zenoss/.ssh/id_ed25519 type -1
debug1: identity file /home/zenoss/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: kex: [email protected] need=16 dh_need=16
debug1: kex: [email protected] need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ***************
The authenticity of host '******' can't be established.
ECDSA key fingerprint is **************************
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '*******' (ECDSA) to the list of known hosts.
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/zenoss/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering DSA public key: /home/zenoss/.ssh/id_dsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/zenoss/.ssh/id_ecdsa
debug1: Trying private key: /home/zenoss/.ssh/id_ed25519
debug1: Next authentication method: password
zenoss@****s password: 

有谁知道这是什么原因以及我如何解决它,禁用 SELinux 不是一个选项。

韩国

linux bash ssh rsa selinux
  • 1 个回答
  • 317 Views
Martin Hope
Matt B
Asked: 2017-03-16 03:30:37 +0800 CST

新手系统管理员 - Bash 脚本协助

  • 0

我是一名新的系统管理员,我正在学习这个角色。我在这里有一个无法工作的 bash 脚本。这只是一个测试脚本,因为它是我的第一个脚本,所以我知道将 authorized_keys 设置为 777 是不明智的,但我这样做只是为了检查我的脚本现在是否有效。

我正在使用带有密码的 LDAP,因此使用密钥通过 SSH 连接到远程设备并不理想,因此我使用的是 ssh 通行证。

此代码适用于 useradd,然后它不会 mkdir .ssh,不会触摸/创建授权密钥,并且不会更改文件权限。

为什么?

#!/bin/bash -x


username="test"


echo Enter server IP:
read server
sshpass -p randompassword ssh myusername@$server sudo -i 'useradd test1;
echo $username user added, press any key to continue;
read;
sudo -i;
mkdir /home/test1/.ssh;
cd /home/test1/.ssh;
touch authorized_keys;
chmod 777 authorized_keys'

我可能无法正确理解 bash 脚本,但所有这些命令都需要在远程机器上运行。

linux scripting bash
  • 2 个回答
  • 111 Views

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve