Skip to main content

Raymii.org Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

Delete a directory on OpenVMS

Published: 03-04-2018 | Author: Remy van Elst | Text only version of this article


Table of Contents


openvms

(You can read all my OpenVMS articles by clicking the picture above)

My OpenVMS adventure continues, in this small item I talk about the removal offolders on OpenVMS. As you might expect, different than on linux.

I tried to set up SSH public key authentication so that I can use my regular SSHkey instead of typing my password on the DECUServe system. I found a guidefor that in the HPe documentation. That however required the creation of somefiles and folders and I made a typo in the creation of a folder. Of course Inoticed that way too late so there were files in there as well.

As you might have guessed, I went down a different rabbit hole to remove thisfolder, SSH public key authentication does not work yet. The DECUServesystem allows SSH login with a password initially.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)

DIR [.SSH]

The folder I created is named SSH, but it should be named SSH2. This iswhat's in the folder:

 $ dir [.SSH]Directory EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH]AUTHORIZATION.;3    REMY-GATEWAY.PUB;1Total of 2 files.

OpenVMS seperates folders with the period (.) and they must be enclosed insquare brackets. The first period expands to the current folder.

After creating the correct folder (CREATE /DIRECTORY [.SSH2]) and copying thefiles over:

 $ copy [.SSH]*.*;* [.SSH2] $ 

It was time to remove the folder.

rm -rf [.SSH]?

Let's try to apply some logic here. CREATE is the command to create files andfolders. So would REMOVE then remove a folder?

 $ REMOVE [.SSH]%DCL-W-IVVERB, unrecognized command verb - check validity and spelling \REMOVE\

Nope, it doesn't. Let's try what we know from *NIX:

 $ RM_Remote host: Interrupt

No clue what that does, but it's not removing my folder. ^C gets me out.

But, OpenVMS has a very extensive HELP system, lets find out what RM does:

RMS     OpenVMS Record Management Services (RMS) are generalized routines     that assist user programs in processing and managing files and     records.      [...]

Okay, nice, but not what I was looking for. RMDIR maybe?

 $ RMDIR [.SSH]%DCL-W-IVVERB, unrecognized command verb - check validity and spelling \RMDIR\

Last resort, the Windows BATCH DEL command:

 $ del_File:Interrupt

That at least asks for a filename. Let's see if we can get the directory syntaxright:

This all failed, syntax wise not the correct format to specify a folder:

$ DEL [.SSH]%DELETE-E-DELVER, explicit version number or wild card required

A version number you say? This excellent filesystem has versioning built in.

 $ DEL [.SSH];1%DELETE-W-SEARCHFAIL, error searching for EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH].;1-RMS-E-FNF, file not found

The version number inside the brackets?

 $ DEL [.SSH;1]%DCL-W-DIRECT, invalid directory syntax - check brackets and other delimiters

The DIR command shows me that the folder is named [.SSH.DIR]. Lets try that:

 $ del [.SSH.DIR];1 %DELETE-W-SEARCHFAIL, error searching for EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH.DIR].;1 -RMS-E-DNF, directory not found -SYSTEM-W-NOSUCHFILE, no such file

At this point in time I thought that maybe I had to remove all the files firstinside the folder. One by one I tried:

 $ DIR [.SSH]Directory EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH]AUTHORIZATION.;3    REMY-GATEWAY.PUB;1Total of 2 files. $ DEL [.SSH]AUTHORIZATION.;3 $ DEL [.SSH]REMY-GATEWAY.PUB;1 $

Folder is empty now:

 $ DIR [.SSH]%DIRECT-W-NOFILES, no files found

Now I surely must be able to remove the folder, right?

$ DEL [.SSH]%DELETE-E-DELVER, explicit version number or wild card required

Sadly not. Reading through the docs I figured out the correct command torecursively delete all files in a folder:

   $ DEL [.SSH]*.*;*   $

The command fails the second time since there are no more files:

 $ DEL [.SSH]*.*;*%DELETE-W-SEARCHFAIL, error searching for EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH]*.*;*-RMS-E-FNF, file not found

If you happen to have subfolders, add the /ERASE flag to recursively deleteeverything:

$ DEL /ERASE [.SSH]*.*;*

Finally the correct DEL syntax, permission error!

Reading the documentation page some more I figured out the correct syntax, nobrackets and no leading perion:

 $ DEL SSH.DIR;1%DELETE-W-FILNOTDEL, error deleting EISNER$DRA3:[DECUSERVE_USER.EXAMPLE]SSH.DIR;1-RMS-E-PRV, insufficient privilege or file protection violation

Different error message, so we're getting there. The manual states:

This command requires delete (D) access to the file and write (W) access tothe parent directory.

Reading, again, the excellent documentation shows me that there is an ACLsystem and a permission system. For now I tried the permission system first.

I figured out that SHOW SECURITY is the command to see the permissions.Permissions on OpenVMS are very different as well from your standard *NIXpermissions.

 $ SHOW SECURITY SSH.DIR;1EISNER$DRA3:[DECUSERVE_USER.EXAMPLE]SSH.DIR;1 object of class FILE     Owner: [EXAMPLE]     Protection: (System: RWE, Owner: RWE, Group, World)     Access Control List: <empty>

Using the SET FILE command we can explicitly add the D permission for theO (Owner) , which is for deletion:

$ SET FILE/PROTECTION=O:RWED SSH.DIR;1$

It did update the permissions:

EISNER$DRA3:[DECUSERVE_USER.EXAMPLE]SSH.DIR;1 object of class FILE     Owner: [EXAMPLE]     Protection: (System: RWE, Owner: RWED, Group, World)     Access Control List: <empty>

Would I now finally be able to remove this directory?

   $ DEL SSH.DIR;1   $

Yay! No error message! And no more folder:

 $ dir [.SSH]%DIRECT-E-OPENIN, error opening EISNER$DRA3:[DECUSERVE_USER.EXAMPLE.SSH]*.*;* as input-RMS-E-DNF, directory not found-SYSTEM-W-NOSUCHFILE, no such file

Conclusion

What have we learned today?

And still no OpenSSH Public key authentication. Enough OpenVMS for this evening,SSH will be next.

Tags: alpha, blog, dec, decus, itanium, openvms, pdp, simh, vax, vms