How to start the X server at boot with Redhat or Oracle Linux

vi /etc/inittab

Edit your /etc/inittab file by replacing the line:

id:3:initdefault:

With this one:

id:5:initdefault:

and reboot

Enjoy!

Source: http://www.redhat.com/support/resources/faqs/rhl_general_faq/s1-xwin-q.html

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Managing the Oracle DB 11g Scheduler Windows (DBMS_SCHEDULER)

To display existing scheduler windows, you should query the “dba_scheduler_windows” table:

e.g.

SELECT WINDOW_NAME,REPEAT_INTERVAL,DURATION,ENABLED
FROM dba_scheduler_windows

In my case, I needed to disable a window, so that it doesn’t run any scheduled jobs, so I had to run the following:

BEGIN
DBMS_SCHEDULER.DISABLE (NAME => ‘SYS.MY_WINDOW‘,
FORCE => TRUE);
END;

For a complete reference for managing the scheduler, this link contains everything you need:

http://docs.oracle.com/cd/B28359_01/server.111/b28310/tasks004.htm

Important note: In order to be able to run the above procedure, you have to be granted the “manage scheduler” privilege, e.g.

“grant manage scheduler to user_name;”

Enjoy!

Posted in Oracle | Tagged , , , , , , | Leave a comment

Limit a Local System User Access to a Certain Folder when using SFTP on Linux (and disable SSH for him as well)

This situation might face a lot of us, if you have a certain file you want to share on your system using SFTP, but you don’t want that user to be able to:

  1. login via SSH and run any commands
  2. limit his access to a certain folder only

This can be done by what’s called chrooting.

To do this in Ubuntu (and can be applied to other Linux distros as well), follow the following steps:

  1. Create a user, let’s say his name is “external” for example
  2. Create a directory that’s writable ONLY by user root and group root “sudo mkdir /shared”
  3. open /etc/ssh/sshd_config for editing “sudo vi /etc/ssh/sshd_config”
  4. Comment the following line: “Subsystem       sftp    /usr/libexec/openssh/sftp-server” and add this section instead “Subsystem       sftp    internal-sftp”
  5. Add the following lines immediately after it, then save and exit:

    Match User external
    ChrootDirectory /shared
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand internal-sftp

  6. Restart the ssh service: “sudo /etc/init.d/ssh restart”

Now we’re done, note that this can be applied to groups as well, not just users.

As a test, first of all try using sftp and navigate to any folder other than /shared, e.g. /etc:

sftp external@myserver
external@myserver’s password:
Connected to myserver.
sftp> cd /etc
Couldn’t canonicalise: No such file or directory
sftp>

Test Successful! You are jailed in the /shared folder and can’t navigate to anywhere else on the server

Second, try using ssh to connect using that user:

ssh external@myserver
external@myserver’s password:
This service allows sftp connections only.

Great! Everything is working now perfectly, Enjoy!

Source: http://www.thegeekstuff.com/2012/03/chroot-sftp-setup/

Posted in Uncategorized | Tagged , , , , | Leave a comment

How to get CPU Info of a Linux Machine

This worked with me in Redhat and Ubuntu-based distros:

“less /proc/cpuinfo”

you can get the number of processors easily if you don’t want to read a lot of text:

“less /proc/cpuinfo | grep processor”
processor : 0
processor : 1
processor : 2
processor : 3

The above sample is on my own laptop with a quad-core Intel Core i5 Processor

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Mount NTFS manually on Ubuntu Linux Server

First, list all the ntfs drives you have: “fdisk -l | grep NTFS”, example output:

/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 409599999 204696576 7 HPFS/NTFS/exFAT
/dev/sda3 409600000 976957421 283678711 7 HPFS/NTFS/exFA

Second, create a folder to mount the NTFS filesystem on, e.g.: “sudo mkdir /media/ntfs1”

Finally, mount the filesystem to that folder, e.g. : “sudo mount -t ntfs /dev/sda3 /media/ntfs1”

This can be applied to other distros as well, for example in RHEL or OEL you can just omit the “sudo” and use user “root” to run the commands instead.

Source: http://linuxconfig.org/How_to_mount_partition_with_ntfs_file_system_and_read_write_access

Posted in Linux | Tagged , , , , , , , , , | Leave a comment