Howto: Eject cd with ssh

in Categories , , , , last updated January 12, 2007

Eject allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under software control. The command can also control some multi-disc CD-ROM changers, the auto-eject feature supported by some devices, and close the disc tray of some CD-ROM drives. Eject can be used remotely over ssh session to eject cds.

First login to remote system over ssh session:
$ ssh user@ras.nixcraft.in
Eject cd using device name:
# eject /dev/cdrom
OR Eject cd using mount point
# eject /mnt/cdrom/

To close tray type command:
# eject -t /mnt/cdrom/If you have multi-disc changer then you can use eject to select disc. For example, select 4th disc on multi-disc changer:# eject -v -c4 /dev/cdrom

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 3 comments/add one below):

3 comment

    Have a question? Post it on our forum!