无法通过su - oracle进行用户切换 su: incorrect password

本文记录了一次使用Linux系统中su命令切换用户遇到的问题及解决过程。在修改了oracle用户的密码后,尝试通过grid用户切换到oracle用户时遭遇失败。通过对su命令权限配置文件的检查与调整,最终解决了该问题。

问题描述:

[root@gasdbadm01 etc]# passwd oracle
Changing password for user oracle.

You can now choose the new password or passphrase.

A good password should be a mix of upper and lower case letters,
digits, and other characters.  You can use a 5 character long
password.


A passphrase should be of at least 3 words, 5 to 40 characters
long, and contain enough different characters.

Alternatively, if noone else can see your terminal now, you can
pick this as your password: "bumpy$turn=cart".

Enter new password: 
Re-type new password: 
passwd: all authentication tokens updated successfully.
[root@gasdbadm01 etc]# su - grid
[grid@gasdbadm01 ~]$ su - oracle
Password: 
su: incorrect password
[grid@gasdbadm01 ~]$

刚刚修改过密码却无法通过su - oracle进行用户切换

问题解决:

[root@gasdbadm01 etc]# ll /bin/su
-rwsr-xr-x 1 root root 34904 Aug 25  2014
/bin/su
[root@gasdbadm01 etc]# vim /etc/pam.d/su
-bash: vim: command not found
[root@gasdbadm01 etc]# vi !$
vi /etc/pam.d/su
[root@gasdbadm01 etc]# 
[root@gasdbadm01 etc]# cat /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
[root@gasdbadm01 etc]# 
将上面一行注释掉
<think>根据用户的问题,他遇到了Git克隆时的认证错误,具体错误信息是:"[session-9a495b87]Nanfengguo: Incorrect usernameor password(accesstoken)"。这表明用户在使用用户名(或账号)"Nanfengguo"进行认证时,提供的密码或访问令牌不正确。###问题分析1.**错误原因**:用户名或密码(访问令牌)错误,导致Git服务器拒绝访问。 2. **可能场景**:-用户输入了错误的密码。-访问令牌已过期或未正确生成。-用户可能使用了错误的认证方式(例如,应该使用令牌却用了密码)。 ###解决方案1. **检查凭据**:-确保用户名正确(这里是"Nanfengguo")。-如果是使用密码,确保密码正确(注意大小写和特殊字符)。-如果使用访问令牌,请确保令牌有效且具有足够的权限(例如,在Gitee上生成的令牌需要勾选`projects`权限)。 2. **重新生成访问令牌**(如果忘记或令牌过期):-登录Gitee ->进入个人设置->安全设置->私人令牌->生成新令牌(确保勾选`projects`权限)。 3. **使用SSH方式克隆**(避免每次输入密码):-生成SSH密钥对(如果尚未生成):```bashssh-keygen-trsa-C"your_email@example.com"```-将公钥(`~/.ssh/id_rsa.pub`)添加到Gitee的SSH公钥设置中。-使用SSH地址克隆:```bashgit clonegit@gitee.com:yeyuzhu/zzd-collect-platform.git```4.**清除缓存的凭据**(如果之前保存了错误的凭据):-对于Windows系统,可以使用凭据管理器删除有关`gitee.com`的凭据。-命令行清除(GitBash):```bashgitcredential rejectprotocol=httpshost=gitee.com```然后按两次回车。###注意事项-如果使用HTTPS方式克隆,在输入用户名时,如果用户名是手机号或邮箱,请确保输入正确。 -访问令牌在生成时只会显示一次,请妥善保存。§§相关问题§§1.如何在Gitee上生成访问令牌并配置Git使用它进行认证? 2.如何将现有的HTTPS远程仓库切换为SSH方式? 3.在Windows系统中如何通过凭据管理器管理Git的认证信息? 4.当多个Git账户需要切换时,如何配置SSH密钥避免冲突? 5.为什么使用SSH方式克隆仓库时仍需要输入密码,如何解决?</think>### 问题分析 您遇到的 `[session-9a495b87] Nanfengguo: Incorrect username or password (access token)` 错误表明 Git 认证失败,具体原因可能是: 1. **凭证错误** - 用户名 "Nanfengguo" 对应的密码/访问令牌不正确 - 访问令牌可能已过期或被撤销 2. **认证方式冲突** - 系统缓存了旧凭证导致新凭证失效 - 同时配置了 HTTPS 和 SSH 认证时可能冲突 ### 解决方案 1. **重置 Git 凭证缓存** ```bash git credential-manager reject https://gitee.com ``` 2. **使用访问令牌替代密码** - 在 Gitee 生成新令牌:`设置 → 私人令牌 → 生成新令牌` - 克隆时用户名填 Gitee 账号,密码填令牌 3. **强制刷新认证流程** ```bash git clone https://Nanfengguo@ gitee.com/yeyuzhu/zzd-collect-platform.git ``` 系统将弹出新认证窗口 4. **检查账户安全设置** - 确认 Gitee 账户未开启二次验证(或已准备好验证器) - 检查账户是否被锁定
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值