Vous êtes sur la page 1sur 5

Linux Set or Change User Password ================================================

How do I set or change Linux system password for any user account? Both Linux and UNIX use the passwd command to change user password. The passwd is used to update a users authentication to en !password" stored in shadow fi#e. The passwd changes passwords for user and group accounts. $ norma# user may on#y change the password for his%her own account& the super user !or root" may change the password for any account. The administrator of a group may change the password for the group. passwd a#so changes account information& such as the fu## name of the user& user's #ogin she##& or password expiry date and inter(a#. Tas ) *et or +hange User ,assword Type passwd command as fo##ows to change your own password) - passwd .utput) +hanging password for (i(e !current" UNIX password) /nter new UNIX password) 0etype new UNIX password) passwd) password updated successfu##y The user is first prompted for his%her o#d password& if one is present. This password is then encrypted and compared against the stored password. The user has on#y one chance to enter the correct password. The super user is permitted to 1ypass this step so that forgotten passwords may 1e changed. $ new password is tested for comp#exity. $s a genera# guide#ine& passwords shou#d consist of 2 to 3 characters inc#uding one or more from each of fo##owing sets) Lower case a#pha1etics Upper case a#pha1etics 4igits 5 thru 6 ,unctuation mar s Tas ) +hange ,assword 7or .ther User $ccount 8ou must #ogin as root user& type the fo##owing command to change password for user (i(e ) 9 passwd (i(e .utput) /nter new UNIX password) 0etype new UNIX password) passwd) password updated successfu##y :here& (i(e ; is username or account name. Tas ) +hange <roup ,assword

:hen the ;g option is used& the password for the named group is changed. In this examp#e& change password for group sa#es) 9 passwd ;g sa#es The current group password is not prompted for. The ;r option is used with the ;g option to remo(e the current password from the named group. This a##ows group access to a## mem1ers. The ;0 option is used with the ;g option to restrict the named group for a## users.

how to delete last command from bash history ======================================= If you ha(e e(er typed something into a command prompt that you wished you hadn't ; you may find it usefu# to now that you can de#ete it from =%.1ash>history (ery easi#y. The command) history ;d offset wi## de#ete the history entry at position offset. 9 history ? cd @ history A #s ;a#h7 B history C wget username)passwordDpri(ate.ftp.com%secret%fi#e.tar.gE 2 history so to de#ete the wget command !which contains a password" ; Fust use) history ;d C 9 history ;d C 9 history ? cd @ history A #s ;a#h7 B history C history 2 history ;d C G history

This is !hopefu##y" the fina# update to an .L4 post. *orta Hpre;*tac .(erf#owH internet. +hec out this Iuestion instead) http)%%superuser.com%Iuestions%A3BA22%remo(e;a;certain;#ine;from;1ash;history;fi#e

Jposted in the comments The 1e#ow is preser(ed on#y for hysterica# accuracy

But suppose you KN.: you're a1out to enter a command you don't want to go into history. It'd 1e nice if you cou#d Fust tac a #itt#e HhidemeH modifer onto the front or tai# of your command and 1e done with it. Unfortunate#y from what I'(e 1een a1#e to goog#e there is no such feature 1ui#t into history or 1ash. Natura##y I made one. TL,M-!history N tai# ;? N aw 'Oprint -?P'" QQ history ;d -TL, QQ R paste>in>she##>and>rep#ace>this>with>whate(er>you>want>to>hide $nd natura##y someone smarter than me came a#ong and found a 1etter way to do it ; TH$NK7ULL8 they posted a comment here to he#p us out !than s LitchS") history ;d -!!HI*T+L4;?"" QQ R paste>in>she##>and>rep#ace>this>with>whate(er>you>want>to>hide 0ather than ho#ding down 1ac space& you may find it usefu# to now that in 1ash +tr#;: wi## de#ete from the cursor to the 1eginning of the pre(ious word. :hat I don't get& is that according man 1ash HI*T+L4 shou#d 1e the +U00/NT history num1er) HI*T+L4 The history num1er& or index in the history #ist& of the current command.

and yet in $LL my tests -HI*T+L4 is the Hindex in the history #ist& of the current commandH T? But it can sti## #ead to two two usefu# a#iases) a#ias hidemeM'history ;d -!!HI*T+L4;?""' a#ias hidepre(M'history ;d -!!HI*T+L4;@"" QQ history ;d -!!HI*T+L4;?""' 4ig the snea y) 9 history ? cd @ history A #s ;a#h7 B history C history 2 history ;d C G history 3 (i .1ashrc 6 history 9 echo password QQ hideme password 9 echo password password

9 hidepre(9 history ? cd @ history A #s ;a#h7 B history C history 2 history ;d C G history 3 (i .1ashrc 6 history ?5 history I now the 1#og's inda 1een on Linux ic #ate#y ; some of that is coming from the new Fo1 ; I'm using Linux more. But& I'(e 1een wor ing on a #itt#e proFect in /c#ipse ; Ua(a%*:T ; and I'm getting to a point where I may ha(e some usefu# #earnings to post coming out of that. .r may1e not... Internet Ta1#et& and a## my x1ox's are running fine... I'd #i e to throw out some props to I(ie for sending me an emai# a1out one of my posts that she read. I try to post stuff that I myse#f ha(e trou1#e finding out there on the interwe1E ; so it's a#ways nice to hear from someone that finds it usefu# ; than s I(ieS ============================================= LINUX USE UL =============================================

export L47L$<*M';:#&;rpath&R--O.0I<INP%..%#i1 ;:#&;rpath&R--O.0I<INP%..%usr%#i1 ;:#&;;ena1#e; new;dtags' ;:#&;rpath;#in &#i1%dir%su1

%usr%s1in%tcpdump ;n ;s5 ;XXX ;((( ;tttt ;i eth5 port @65C ;w +hec Traces.pcap

getconf >N,0.+/**.0*>.NLN getconf L.N<>BIT

/xecution seIuence ?. /etc/profile gets executed @. ~/.bash_profile gets executed A. ~/.bash_login gets executed B. ~/.profile gets executed

C.

~/.bashrc gets executed for non-login shell testing

:hen a she## runs a script or a command passed on its command #ine& it's a non! interacti"e# non!login she##. *uch she##s run a## the time) it's (ery common that when a program ca##s another program& it rea##y runs a tiny script in a she## to in(o e that other program. *ome she##s read a startup fi#e in this case ! sh and 1ash run the fi#e indicated 1y the /NV (aria1#e& Esh runs %etc%Eshen( and =%.Eshen("& 1ut this is ris y) the she## can 1e in(o ed in a## sorts of contexts& and there's hard#y anything you can do that might not 1rea something. Understanding fields in $etc$%asswd The %etc%passwd contains one entry per #ine for each user !or user account" of the system. $## fie#ds are separated 1y a co#on !)" sym1o#. Tota# se(en fie#ds as fo##ows. <enera##y& passwd fi#e entry #oo s as fo##ows !c#ic to en#arge image") !7ig.5?) %etc%passwd fi#e format ; c#ic to en#arge" Username) It is used when user #ogs in. It shou#d 1e 1etween ? and A@ characters in #ength. ,assword) $n x character indicates that encrypted password is stored in %etc%shadow fi#e. User I4 !UI4") /ach user must 1e assigned a user I4 !UI4". UI4 5 !Eero" is reser(ed for root and UI4s ?;66 are reser(ed for other predefined accounts. 7urther UI4 ?55;666 are reser(ed 1y system for administrati(e and system accounts%groups. <roup I4 !<I4") The primary group I4 !stored in %etc%group fi#e" User I4 Info) The comment fie#d. It a##ow you to add extra information a1out the users such as user's fu## name& phone num1er etc. This fie#d use 1y finger command. Home directory) The a1so#ute path to the directory the user wi## 1e in when they #og in. If this directory does not exists then users directory 1ecomes % +ommand%she##) The a1so#ute path of a command or she## !%1in%1ash". Typica##y& this is a she##. ,#ease note that it does not ha(e to 1e a she##.

Vous aimerez peut-être aussi