Linux Programmer | RHCE | RHCSA

Search This Blog

Tuesday, 31 July 2018

How to handle more than 10 parameters in shell

Use curly braces to set them off:
echo "${10}"
You can also iterate over the positional parameters like this:
for arg
or
for arg in "$@"
or
while (( $# > 0 ))    # or [ $# -gt 0 ]
do
    echo "$1"
    shift
done

Thursday, 26 July 2018

Windows shared network printer issue in ubuntu 18.04

Windows shared network printing issue in ubuntu 18.04.

- printers are installed in windows 8 machine and shared.
- when try to find the network printer from ubuntu 18.04 using the ip of windows machine then it is showing an error 
"no network printer found"

- even, when we found the shared folders using smbclient command then it will showing an error


smbclient -L 192.168.1.20
output:
syslog option deprecated,
Enter WORKGROUP\root's password:

    Sharename       Type      Comment
    ---------       ----      -------

    ADMIN$          Disk      Remote Admin
    Backup          Disk     
    bk              Disk     
    bkp             Disk     
    C$              Disk      Default share
    Canon UFR II Color Class Driver Printer   Canon UFR II Color Class Driver
    Canon-LBP2900-toc64 Printer   Canon LBP2900
    Canon2900       Printer   \\MUIN-KHAN\Canon-LBP2900
    D$              Disk      Default share
    Data            Disk     
    HP-LaserJet-M1005 Printer   \\KESHA\Hewlett-Packard-HP-LaserJet-M1005
    IPC$            IPC       Remote IPC
    libjack         Disk     
    print$          Disk      Printer Drivers
    raj             Disk     
    Users           Disk     
Reconnecting with SMB1 for workgroup listing.
Connection to 192.168.1.20 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Failed to connect with SMB1 -- no workgroup available


it is showing an error as showing in bold letter.

even if are checking the syslog then it will be like,

Jul 26 10:01:03 localhost dbus-daemon[712]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jul 26 10:01:03 localhost systemd[1]: Started Hostname Service.
Jul 26 10:01:20 localhost python: io/hpmud/jd.c 93: unable to read device-id
Jul 26 10:01:20 localhost python: io/hpmud/jd.c 745: invalid ip 192.168.1.20
Jul 26 10:01:20 localhost hp-makeuri: hp-makeuri[13665]: error: Device not found



Solution:

First: Ubuntu does not install a smb.conf in 18.04 so I suggest you install the samba client package:

Code:
sudo apt install smbclient
Second: Then edit /etc/samba/smb.conf and right unser the workgroup = WORKGROUP line add this line to change the default:
Code:
client max protocol = NT1
Third: Install samba packages.
Code:
apt-get install samba
and reboot.... Yes reboot..
fourth: Install CUPS:
Code:
apt-get install cups; apt-get install cups-bsd 

fifth: Install python3-smbc:
Code:
apt-get install python3-smbc
 Now try to find network printer from system-config-printer 

it works !!!

Wednesday, 18 July 2018

X11Forwarding with SSH not working when connect user through Ncomputing device ?

X11Forwarding with SSH not working when connect user through N-computing device ?
Issue Description:

Install N-computing Server in one linux machine.
Trying to connect another user through Ncomputing client using Vspace.

User logged in successfully but when the connected user tried to connect another machine through ssh using X11forwading then it is not working .

For e.g.

$ ssh purval@192.168.1.76 -CX

then it take some time to login and after 1 or 2 minute it will logged in successfully.

but when we try to open some GUI application then it wont open.

Solution:

1. Logout the SSH session
2. run below command with normal user
      $ xhost +
3. Login user using SSH with -CX and try to open application.

it works !!


if you enter $xhost command it will show output like,

access control disabled, clients can connect from any host

$xhost - will remove the xhost access control which you have set.

About Xhost

xhost is a server access control program for X. It is used to add and delete host names or user names to the list allowed to make connections to the X server. In the case of hosts, this provides a rudimentary form of privacy control and security. It is only sufficient for a workstation (single user) environment, although it does limit the worst abuses in other cases. Environments which require more sophisticated measures should implement the user-based mechanism or use the hooks in the protocol for passing other authentication data to the server.


Thank you,



SSH not working with password after upgrade ubuntu 22.04 or above

In recent upgrade of ubuntu 22.04 and above we are not able to login server with SSH password. but when we try to login with key then it all...