From owner-freebsd-questions Tue Oct 30 8:30:37 2001 Delivered-To: freebsd-questions@freebsd.org Received: from drone2.qsi.net.nz (drone2-svc-skyt.qsi.net.nz [202.89.128.2]) by hub.freebsd.org (Postfix) with SMTP id 3AC3237B403 for ; Tue, 30 Oct 2001 08:30:28 -0800 (PST) Received: (qmail 39316 invoked by uid 0); 30 Oct 2001 16:30:26 -0000 Received: from unknown (HELO tetron.ijs.co.nz) ([202.89.142.19]) (envelope-sender ) by 0 (qmail-ldap-1.03) with SMTP for ; 30 Oct 2001 16:30:26 -0000 Message-Id: <5.1.0.14.2.20011031062051.03648cc0@202.89.128.27> X-Sender: research@202.89.128.27 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 31 Oct 2001 06:30:18 +1300 To: freebsd-questions@freebsd.org From: Craig Carey Subject: Re: Stupid, stupid ... ( GLOBIGNORE=.. In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 01.10.28 12:17 -0500 Sunday, Philip Mak wrote: >I just did a stupid thing to lock myself out of one of my boxes that I >only have remote ssh access to. I thought I'd share it with you guys so >that no one else makes the same mistake. > >Never type "chmod o-rx .*" when logged in as root, inside root's home >directory (/root). That will affect .. as well, meaning that the directory >"/" will no longer be accessible to normal users. > GNU chmod does not contain globbing code. If the shell is bash, then a solution is to use "GLOBIGNORE=..". ----------------------------------------------------- What happens when the command is "chmod 000 .*" : Case 1: When GLOBIGNORE= then all the files in the current directory with names starting with "." or ".." are made read only. Also so are the directories "." and "..". Case 2: When GLOBIGNORE=.. then the .* and ..* files are also altered, and the "." and ".." directories are not altered. ----------------------------------------------------- Setting "GLOBIGNORE=.." is able to stop commands affecting the directory above when they get the glob pattern: ".*". That could be put into a bash "profile" file or ".bashrc" file. Bash: GLOBIGNORE A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. If a filename matched by a pathname expansion pattern also matches one of the patterns in GLOBIGNORE, it is removed from the list of matches. >Now I can't ssh into my box (any attempt to connect will say "Cannot find >root directory" and kick me out) to fix this, so I have to wait for the >guy who has physical access to the box to fix it. > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message