Bitcoin Forum
September 03, 2024, 06:14:03 PM
Welcome,
Guest
. Please
login
or
register
.
News
: Latest Bitcoin Core release:
27.1
[
Torrent
]
Home
Help
Search
Login
Register
More
Bitcoin Forum
>
Local
>
中文 (Chinese)
>
离题万里
>
如何重置CentOS/RHEL 7中遗忘的根用户帐户密码?
Pages: [
1
]
« previous topic
next topic »
Print
Author
Topic: 如何重置CentOS/RHEL 7中遗忘的根用户帐户密码? (Read 358 times)
Jerrietg
(OP)
Sr. Member
Offline
Activity: 350
Merit: 250
如何重置CentOS/RHEL 7中遗忘的根用户帐户密码?
April 07, 2015, 02:35:10 AM
#1
你有没有遇到过这种情况:想不起来Linux系统上的用户帐户密码?要是你忘了根用户密码,情况就更为糟糕。你无法执行任何面向整个系统的变更。要是你忘了用户密码,很容易使用根帐户来重置密码。
可要是你忘了根帐户密码,那该如何是好?你无法使用用户帐户来重置根帐户密码,因为用户帐户通常无权执行这种任务。
重置CentOS 7和RHEL 7中遗忘的根用户帐户密码
万一你遇到了这种情况,这篇指南文章可以帮助你摆脱此类困境。本文将介绍如何重置RHEL 7和CentOS 7根帐户密码。
今天一大早,我打开了RHEL 7 Linux服务器,结果却发现它被锁住了。不是我搞砸了前一晚更改的密码,就是确确实实忘了密码。
遗忘的根帐户密码
那么,我现在该如何是好?我应该使用用户帐户登录,试着更改根帐户密码吗?
只有根用户才能设置密码
糟糕的是,我看到的信息是“Only root can specify a user name”(“只有根帐户才能指定用户名称”),我对根帐户失去了控制权。于是我打算引导进入到单一用户模式。为此,重启服务器;一旦你看到下列屏幕,就按键盘上的“e”(代表编辑)。
按“e”进入编辑引导菜单
在你按了键盘上的“e”后,你会看到许多文本,文本内容会根据屏幕尺寸来缩短。
Grub配置
搜寻文本“rhgb quiet”,将它换成“init=/bin/bash”,不要引号。
启用外壳
一旦完成了编辑,按“ctrl+x”组合键,它会开始以指定的参数来引导。你会获得bash提示符。
引导系统
现在,在单一用户模式上运行下列命令,检查根分区的状态。
# mount | grep root[/pre]
检查根分区挂载状态
你可能注意到,根分区被报告为“ro”(只读)。我们需要对根分区拥有读写权限,才能更改根帐户密码。
# mount -o remount,rw /[/pre]另外反复检查一下,看看根分配是否以读写权限模式来挂载。
# mount | grep root[/pre]
对根分区设置权限
现在你可以更改根帐户密码了,只要键入passwd命令。但这还没完。我们需要重新标记SELinux上下文。如果我们跳过重新标记整个SELinux上下文这一步,就能够使用using password来登录了。
# passwd root[输入新密码][重新输入新密码][/pre]# touch /.autorelabel[/pre]
重置根帐户密码
重启,再次登录进入到根帐户,看看一切是不是正常了?
# exec /sbin/init[/pre]
登录根用户
上图清楚地显示,我们已通过从单一用户模式重置根帐户密码,成功登录进入到RHEL 7系统。
上述几个步骤清楚地显示了如何通过从单一用户模式重置根帐户密码,登录到RHEL 7和CentOS 7机器。
Pages: [
1
]
Print
Bitcoin Forum
>
Local
>
中文 (Chinese)
>
离题万里
>
如何重置CentOS/RHEL 7中遗忘的根用户帐户密码?
« previous topic
next topic »
Jump to:
Please select a destination:
-----------------------------
Bitcoin
-----------------------------
=> Bitcoin Discussion
===> Legal
===> Press
===> Meetups
===> Important Announcements
=> Development & Technical Discussion
===> Wallet software
=====> Electrum
=====> Bitcoin Wallet for Android
=====> BitcoinJ
=====> Armory
=====> Mycelium
=====> Hardware wallets
=> Mining
===> Mining support
===> Pools
===> Mining software (miners)
===> Hardware
=====> Group buys
===> Mining speculation
=> Bitcoin Technical Support
=> Project Development
-----------------------------
Economy
-----------------------------
=> Economics
===> Speculation
=> Marketplace
===> Goods
=====> Computer hardware
=====> Digital goods
=======> Invites & Accounts
=====> Collectibles
===> Services
===> Currency exchange
===> Gambling
=====> Games and rounds
=====> Investor-based games
=====> Gambling discussion
===> Lending
=====> Long-term offers
===> Securities
===> Auctions
===> Service Announcements
=====> Micro Earnings
===> Service Discussion
=====> Web Wallets
=====> Exchanges
=> Trading Discussion
===> Scam Accusations
===> Reputation
-----------------------------
Other
-----------------------------
=> Meta
===> New forum software
===> Bitcoin Wiki
=> Politics & Society
=> Beginners & Help
=> Off-topic
=> Serious discussion
===> Ivory Tower
=> Archival
===> Корзина
===> CPU/GPU Bitcoin mining hardware
===> Chinese students
===> Obsolete (buying)
===> Obsolete (selling)
===> MultiBit
-----------------------------
Alternate cryptocurrencies
-----------------------------
=> Altcoin Discussion
=> Announcements (Altcoins)
===> Tokens (Altcoins)
=> Mining (Altcoins)
===> Pools (Altcoins)
=> Marketplace (Altcoins)
===> Service Announcements (Altcoins)
===> Service Discussion (Altcoins)
===> Bounties (Altcoins)
=> Speculation (Altcoins)
-----------------------------
Local
-----------------------------
=> العربية (Arabic)
===> العملات البديلة (Altcoins)
=====> النقاشات
===> إستفسارات و أسئلة المبتدئين
===> التعدين
===> النقاشات الأخرى
===> منصات التبادل
=> Bahasa Indonesia (Indonesian)
===> Marketplace (Bahasa Indonesia)
===> Mining (Bahasa Indonesia)
===> Altcoins (Bahasa Indonesia)
===> Trading dan Spekulasi
===> Ekonomi, Politik, dan Budaya
===> Topik Lainnya
=> Español (Spanish)
===> Mercado y Economía
=====> Servicios
=====> Trading y especulación
===> Hardware y Minería
===> Esquina Libre
===> Mercadillo
=====> Mexico
=====> Argentina
=====> España
=====> Centroamerica y Caribe
===> Primeros pasos y ayuda
===> Altcoins (criptomonedas alternativas)
=====> Minería de altcoins
=====> Servicios
=====> Tokens (Español)
=> 中文 (Chinese)
===> 跳蚤市场
===> 山寨币
===> 媒体
===> 挖矿
===> 离题万里
=> Hrvatski (Croatian)
===> Trgovina
===> Altcoins (Hrvatski)
=====> Announcements (Hrvatski)
===> Off-topic (Hrvatski)
=> Deutsch (German)
===> Anfänger und Hilfe
===> Mining (Deutsch)
===> Trading und Spekulation
===> Projektentwicklung
===> Off-Topic (Deutsch)
===> Treffen
===> Presse
===> Altcoins (Deutsch)
=====> Announcements (Deutsch)
===> Marktplatz
=====> Auktionen
=====> Suche
=====> Biete
=> Ελληνικά (Greek)
===> Αγορά
===> Mining Discussion (Ελληνικά)
===> Altcoins (Ελληνικά)
=====> Altcoin Announcements (Ελληνικά)
=====> Altcoin Mining (Ελληνικά)
=> עברית (Hebrew)
=> Français
===> Actualité et News
===> Débutants
===> Discussions générales et utilisation du Bitcoin
===> Mining et Hardware
===> Économie et spéculation
===> Place de marché
=====> Échanges
=====> Produits et services
=====> Petites annonces
===> Le Bitcoin et la loi
===> Wiki, documentation et traduction
===> Développement et technique
===> Vos sites et projets
===> Hors-sujet
===> Altcoins (Français)
=====> Annonces
=> India
===> Mining (India)
===> Marketplace (India)
===> Regional Languages (India)
===> Press & News from India
===> Alt Coins (India)
===> Buyer/ Seller Reputations (India)
===> Off-Topic (India)
=> Italiano (Italian)
===> Guide (Italiano)
===> Progetti
===> Discussioni avanzate e sviluppo
===> Trading, analisi e speculazione
===> Mercato
=====> Mercato valute
=====> Beni
=====> Servizi
=====> Esercizi commerciali
=====> Hardware/Mining (Italiano)
=====> Gambling (Italiano)
===> Accuse scam/truffe
===> Mining (Italiano)
===> Alt-Currencies (Italiano)
=====> Annunci
===> Raduni/Meeting (Italiano)
===> Crittografia e decentralizzazione
===> Off-Topic (Italiano)
=> 日本語 (Japanese)
===> アルトコイン
=> Nederlands (Dutch)
===> Markt
===> Gokken/lotterijen
===> Mining (Nederlands)
===> Beurzen
===> Alt Coins (Nederlands)
===> Off-topic (Nederlands)
===> Meetings (Nederlands)
=> Nigeria (Naija)
===> Politics and society (Naija)
===> Off-topic (Naija)
=> 한국어 (Korean)
===> 대체코인 Alt Coins (한국어)
=> Pilipinas
===> Altcoins (Pilipinas)
=====> Altcoin Announcements (Pilipinas)
===> Pamilihan
===> Others (Pilipinas)
=> Polski
===> Tablica ogłoszeń
===> Alternatywne kryptowaluty
=====> Nowe kryptowaluty i tokeny
=====> Tablica ogłoszeń (altcoiny)
=> Português (Portuguese)
===> Primeiros Passos (Iniciantes)
===> Economia & Mercado
===> Mineração em Geral
===> Desenvolvimento & Discussões Técnicas
===> Criptomoedas Alternativas
===> Brasil
===> Portugal
=> Русский (Russian)
===> Новички
===> Бизнес
=====> Барахолка
=====> Обменники
===> Идеи
===> Кодеры
===> Майнеры
===> Политика
===> Трейдеры
===> Альтернативные криптовалюты
=====> Токены
=====> Бayнти и aиpдpoпы
===> Хайпы
===> Работа
===> Разное
===> Oбcyждeниe Bitcoin
=====> Новости
=====> Юристы
=> Română (Romanian)
===> Anunturi importante
===> Offtopic
===> Market
=====> Discutii Servicii
===> Minerit
===> Tutoriale
===> Bine ai venit!
===> Presa
===> Altcoins (Monede Alternative)
=====> Anunturi Monede Alternative
=> Skandinavisk
=> Türkçe (Turkish)
===> Bitcoin Haberleri
===> Pazar Alanı
===> Madencilik
===> Ekonomi
===> Servisler
=====> Fonlar
===> Proje Geliştirme
===> Alternatif Kripto-Paralar
=====> Madencilik (Alternatif Kripto-Paralar)
=====> Duyurular (Alternatif Kripto-Paralar)
===> Konu Dışı
===> Yeni Başlayanlar & Yardım
===> Buluşmalar
=> Other languages/locations
Loading...